1
0

ivprog.bundle.js 2.1 MB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936893789388939894089418942894389448945894689478948894989508951895289538954895589568957895889598960896189628963896489658966896789688969897089718972897389748975897689778978897989808981898289838984898589868987898889898990899189928993899489958996899789988999900090019002900390049005900690079008900990109011901290139014901590169017901890199020902190229023902490259026902790289029903090319032903390349035903690379038903990409041904290439044904590469047904890499050905190529053905490559056905790589059906090619062906390649065906690679068906990709071907290739074907590769077907890799080908190829083908490859086908790889089909090919092909390949095909690979098909991009101910291039104910591069107910891099110911191129113911491159116911791189119912091219122912391249125912691279128912991309131913291339134913591369137913891399140914191429143914491459146914791489149915091519152915391549155915691579158915991609161916291639164916591669167916891699170917191729173917491759176917791789179918091819182918391849185918691879188918991909191919291939194919591969197919891999200920192029203920492059206920792089209921092119212921392149215921692179218921992209221922292239224922592269227922892299230923192329233923492359236923792389239924092419242924392449245924692479248924992509251925292539254925592569257925892599260926192629263926492659266926792689269927092719272927392749275927692779278927992809281928292839284928592869287928892899290929192929293929492959296929792989299930093019302930393049305930693079308930993109311931293139314931593169317931893199320932193229323932493259326932793289329933093319332933393349335933693379338933993409341934293439344934593469347934893499350935193529353935493559356935793589359936093619362936393649365936693679368936993709371937293739374937593769377937893799380938193829383938493859386938793889389939093919392939393949395939693979398939994009401940294039404940594069407940894099410941194129413941494159416941794189419942094219422942394249425942694279428942994309431943294339434943594369437943894399440944194429443944494459446944794489449945094519452945394549455945694579458945994609461946294639464946594669467946894699470947194729473947494759476947794789479948094819482948394849485948694879488948994909491949294939494949594969497949894999500950195029503950495059506950795089509951095119512951395149515951695179518951995209521952295239524952595269527952895299530953195329533953495359536953795389539954095419542954395449545954695479548954995509551955295539554955595569557955895599560956195629563956495659566956795689569957095719572957395749575957695779578957995809581958295839584958595869587958895899590959195929593959495959596959795989599960096019602960396049605960696079608960996109611961296139614961596169617961896199620962196229623962496259626962796289629963096319632963396349635963696379638963996409641964296439644964596469647964896499650965196529653965496559656965796589659966096619662966396649665966696679668966996709671967296739674967596769677967896799680968196829683968496859686968796889689969096919692969396949695969696979698969997009701970297039704970597069707970897099710971197129713971497159716971797189719972097219722972397249725972697279728972997309731973297339734973597369737973897399740974197429743974497459746974797489749975097519752975397549755975697579758975997609761976297639764976597669767976897699770977197729773977497759776977797789779978097819782978397849785978697879788978997909791979297939794979597969797979897999800980198029803980498059806980798089809981098119812981398149815981698179818981998209821982298239824982598269827982898299830983198329833983498359836983798389839984098419842984398449845984698479848984998509851985298539854985598569857985898599860986198629863986498659866986798689869987098719872987398749875987698779878987998809881988298839884988598869887988898899890989198929893989498959896989798989899990099019902990399049905990699079908990999109911991299139914991599169917991899199920992199229923992499259926992799289929993099319932993399349935993699379938993999409941994299439944994599469947994899499950995199529953995499559956995799589959996099619962996399649965996699679968996999709971997299739974997599769977997899799980998199829983998499859986998799889989999099919992999399949995999699979998999910000100011000210003100041000510006100071000810009100101001110012100131001410015100161001710018100191002010021100221002310024100251002610027100281002910030100311003210033100341003510036100371003810039100401004110042100431004410045100461004710048100491005010051100521005310054100551005610057100581005910060100611006210063100641006510066100671006810069100701007110072100731007410075100761007710078100791008010081100821008310084100851008610087100881008910090100911009210093100941009510096100971009810099101001010110102101031010410105101061010710108101091011010111101121011310114101151011610117101181011910120101211012210123101241012510126101271012810129101301013110132101331013410135101361013710138101391014010141101421014310144101451014610147101481014910150101511015210153101541015510156101571015810159101601016110162101631016410165101661016710168101691017010171101721017310174101751017610177101781017910180101811018210183101841018510186101871018810189101901019110192101931019410195101961019710198101991020010201102021020310204102051020610207102081020910210102111021210213102141021510216102171021810219102201022110222102231022410225102261022710228102291023010231102321023310234102351023610237102381023910240102411024210243102441024510246102471024810249102501025110252102531025410255102561025710258102591026010261102621026310264102651026610267102681026910270102711027210273102741027510276102771027810279102801028110282102831028410285102861028710288102891029010291102921029310294102951029610297102981029910300103011030210303103041030510306103071030810309103101031110312103131031410315103161031710318103191032010321103221032310324103251032610327103281032910330103311033210333103341033510336103371033810339103401034110342103431034410345103461034710348103491035010351103521035310354103551035610357103581035910360103611036210363103641036510366103671036810369103701037110372103731037410375103761037710378103791038010381103821038310384103851038610387103881038910390103911039210393103941039510396103971039810399104001040110402104031040410405104061040710408104091041010411104121041310414104151041610417104181041910420104211042210423104241042510426104271042810429104301043110432104331043410435104361043710438104391044010441104421044310444104451044610447104481044910450104511045210453104541045510456104571045810459104601046110462104631046410465104661046710468104691047010471104721047310474104751047610477104781047910480104811048210483104841048510486104871048810489104901049110492104931049410495104961049710498104991050010501105021050310504105051050610507105081050910510105111051210513105141051510516105171051810519105201052110522105231052410525105261052710528105291053010531105321053310534105351053610537105381053910540105411054210543105441054510546105471054810549105501055110552105531055410555105561055710558105591056010561105621056310564105651056610567105681056910570105711057210573105741057510576105771057810579105801058110582105831058410585105861058710588105891059010591105921059310594105951059610597105981059910600106011060210603106041060510606106071060810609106101061110612106131061410615106161061710618106191062010621106221062310624106251062610627106281062910630106311063210633106341063510636106371063810639106401064110642106431064410645106461064710648106491065010651106521065310654106551065610657106581065910660106611066210663106641066510666106671066810669106701067110672106731067410675106761067710678106791068010681106821068310684106851068610687106881068910690106911069210693106941069510696106971069810699107001070110702107031070410705107061070710708107091071010711107121071310714107151071610717107181071910720107211072210723107241072510726107271072810729107301073110732107331073410735107361073710738107391074010741107421074310744107451074610747107481074910750107511075210753107541075510756107571075810759107601076110762107631076410765107661076710768107691077010771107721077310774107751077610777107781077910780107811078210783107841078510786107871078810789107901079110792107931079410795107961079710798107991080010801108021080310804108051080610807108081080910810108111081210813108141081510816108171081810819108201082110822108231082410825108261082710828108291083010831108321083310834108351083610837108381083910840108411084210843108441084510846108471084810849108501085110852108531085410855108561085710858108591086010861108621086310864108651086610867108681086910870108711087210873108741087510876108771087810879108801088110882108831088410885108861088710888108891089010891108921089310894108951089610897108981089910900109011090210903109041090510906109071090810909109101091110912109131091410915109161091710918109191092010921109221092310924109251092610927109281092910930109311093210933109341093510936109371093810939109401094110942109431094410945109461094710948109491095010951109521095310954109551095610957109581095910960109611096210963109641096510966109671096810969109701097110972109731097410975109761097710978109791098010981109821098310984109851098610987109881098910990109911099210993109941099510996109971099810999110001100111002110031100411005110061100711008110091101011011110121101311014110151101611017110181101911020110211102211023110241102511026110271102811029110301103111032110331103411035110361103711038110391104011041110421104311044110451104611047110481104911050110511105211053110541105511056110571105811059110601106111062110631106411065110661106711068110691107011071110721107311074110751107611077110781107911080110811108211083110841108511086110871108811089110901109111092110931109411095110961109711098110991110011101111021110311104111051110611107111081110911110111111111211113111141111511116111171111811119111201112111122111231112411125111261112711128111291113011131111321113311134111351113611137111381113911140111411114211143111441114511146111471114811149111501115111152111531115411155111561115711158111591116011161111621116311164111651116611167111681116911170111711117211173111741117511176111771117811179111801118111182111831118411185111861118711188111891119011191111921119311194111951119611197111981119911200112011120211203112041120511206112071120811209112101121111212112131121411215112161121711218112191122011221112221122311224112251122611227112281122911230112311123211233112341123511236112371123811239112401124111242112431124411245112461124711248112491125011251112521125311254112551125611257112581125911260112611126211263112641126511266112671126811269112701127111272112731127411275112761127711278112791128011281112821128311284112851128611287112881128911290112911129211293112941129511296112971129811299113001130111302113031130411305113061130711308113091131011311113121131311314113151131611317113181131911320113211132211323113241132511326113271132811329113301133111332113331133411335113361133711338113391134011341113421134311344113451134611347113481134911350113511135211353113541135511356113571135811359113601136111362113631136411365113661136711368113691137011371113721137311374113751137611377113781137911380113811138211383113841138511386113871138811389113901139111392113931139411395113961139711398113991140011401114021140311404114051140611407114081140911410114111141211413114141141511416114171141811419114201142111422114231142411425114261142711428114291143011431114321143311434114351143611437114381143911440114411144211443114441144511446114471144811449114501145111452114531145411455114561145711458114591146011461114621146311464114651146611467114681146911470114711147211473114741147511476114771147811479114801148111482114831148411485114861148711488114891149011491114921149311494114951149611497114981149911500115011150211503115041150511506115071150811509115101151111512115131151411515115161151711518115191152011521115221152311524115251152611527115281152911530115311153211533115341153511536115371153811539115401154111542115431154411545115461154711548115491155011551115521155311554115551155611557115581155911560115611156211563115641156511566115671156811569115701157111572115731157411575115761157711578115791158011581115821158311584115851158611587115881158911590115911159211593115941159511596115971159811599116001160111602116031160411605116061160711608116091161011611116121161311614116151161611617116181161911620116211162211623116241162511626116271162811629116301163111632116331163411635116361163711638116391164011641116421164311644116451164611647116481164911650116511165211653116541165511656116571165811659116601166111662116631166411665116661166711668116691167011671116721167311674116751167611677116781167911680116811168211683116841168511686116871168811689116901169111692116931169411695116961169711698116991170011701117021170311704117051170611707117081170911710117111171211713117141171511716117171171811719117201172111722117231172411725117261172711728117291173011731117321173311734117351173611737117381173911740117411174211743117441174511746117471174811749117501175111752117531175411755117561175711758117591176011761117621176311764117651176611767117681176911770117711177211773117741177511776117771177811779117801178111782117831178411785117861178711788117891179011791117921179311794117951179611797117981179911800118011180211803118041180511806118071180811809118101181111812118131181411815118161181711818118191182011821118221182311824118251182611827118281182911830118311183211833118341183511836118371183811839118401184111842118431184411845118461184711848118491185011851118521185311854118551185611857118581185911860118611186211863118641186511866118671186811869118701187111872118731187411875118761187711878118791188011881118821188311884118851188611887118881188911890118911189211893118941189511896118971189811899119001190111902119031190411905119061190711908119091191011911119121191311914119151191611917119181191911920119211192211923119241192511926119271192811929119301193111932119331193411935119361193711938119391194011941119421194311944119451194611947119481194911950119511195211953119541195511956119571195811959119601196111962119631196411965119661196711968119691197011971119721197311974119751197611977119781197911980119811198211983119841198511986119871198811989119901199111992119931199411995119961199711998119991200012001120021200312004120051200612007120081200912010120111201212013120141201512016120171201812019120201202112022120231202412025120261202712028120291203012031120321203312034120351203612037120381203912040120411204212043120441204512046120471204812049120501205112052120531205412055120561205712058120591206012061120621206312064120651206612067120681206912070120711207212073120741207512076120771207812079120801208112082120831208412085120861208712088120891209012091120921209312094120951209612097120981209912100121011210212103121041210512106121071210812109121101211112112121131211412115121161211712118121191212012121121221212312124121251212612127121281212912130121311213212133121341213512136121371213812139121401214112142121431214412145121461214712148121491215012151121521215312154121551215612157121581215912160121611216212163121641216512166121671216812169121701217112172121731217412175121761217712178121791218012181121821218312184121851218612187121881218912190121911219212193121941219512196121971219812199122001220112202122031220412205122061220712208122091221012211122121221312214122151221612217122181221912220122211222212223122241222512226122271222812229122301223112232122331223412235122361223712238122391224012241122421224312244122451224612247122481224912250122511225212253122541225512256122571225812259122601226112262122631226412265122661226712268122691227012271122721227312274122751227612277122781227912280122811228212283122841228512286122871228812289122901229112292122931229412295122961229712298122991230012301123021230312304123051230612307123081230912310123111231212313123141231512316123171231812319123201232112322123231232412325123261232712328123291233012331123321233312334123351233612337123381233912340123411234212343123441234512346123471234812349123501235112352123531235412355123561235712358123591236012361123621236312364123651236612367123681236912370123711237212373123741237512376123771237812379123801238112382123831238412385123861238712388123891239012391123921239312394123951239612397123981239912400124011240212403124041240512406124071240812409124101241112412124131241412415124161241712418124191242012421124221242312424124251242612427124281242912430124311243212433124341243512436124371243812439124401244112442124431244412445124461244712448124491245012451124521245312454124551245612457124581245912460124611246212463124641246512466124671246812469124701247112472124731247412475124761247712478124791248012481124821248312484124851248612487124881248912490124911249212493124941249512496124971249812499125001250112502125031250412505125061250712508125091251012511125121251312514125151251612517125181251912520125211252212523125241252512526125271252812529125301253112532125331253412535125361253712538125391254012541125421254312544125451254612547125481254912550125511255212553125541255512556125571255812559125601256112562125631256412565125661256712568125691257012571125721257312574125751257612577125781257912580125811258212583125841258512586125871258812589125901259112592125931259412595125961259712598125991260012601126021260312604126051260612607126081260912610126111261212613126141261512616126171261812619126201262112622126231262412625126261262712628126291263012631126321263312634126351263612637126381263912640126411264212643126441264512646126471264812649126501265112652126531265412655126561265712658126591266012661126621266312664126651266612667126681266912670126711267212673126741267512676126771267812679126801268112682126831268412685126861268712688126891269012691126921269312694126951269612697126981269912700127011270212703127041270512706127071270812709127101271112712127131271412715127161271712718127191272012721127221272312724127251272612727127281272912730127311273212733127341273512736127371273812739127401274112742127431274412745127461274712748127491275012751127521275312754127551275612757127581275912760127611276212763127641276512766127671276812769127701277112772127731277412775127761277712778127791278012781127821278312784127851278612787127881278912790127911279212793127941279512796127971279812799128001280112802128031280412805128061280712808128091281012811128121281312814128151281612817128181281912820128211282212823128241282512826128271282812829128301283112832128331283412835128361283712838128391284012841128421284312844128451284612847128481284912850128511285212853128541285512856128571285812859128601286112862128631286412865128661286712868128691287012871128721287312874128751287612877128781287912880128811288212883128841288512886128871288812889128901289112892128931289412895128961289712898128991290012901129021290312904129051290612907129081290912910129111291212913129141291512916129171291812919129201292112922129231292412925129261292712928129291293012931129321293312934129351293612937129381293912940129411294212943129441294512946129471294812949129501295112952129531295412955129561295712958129591296012961129621296312964129651296612967129681296912970129711297212973129741297512976129771297812979129801298112982129831298412985129861298712988129891299012991129921299312994129951299612997129981299913000130011300213003130041300513006130071300813009130101301113012130131301413015130161301713018130191302013021130221302313024130251302613027130281302913030130311303213033130341303513036130371303813039130401304113042130431304413045130461304713048130491305013051130521305313054130551305613057130581305913060130611306213063130641306513066130671306813069130701307113072130731307413075130761307713078130791308013081130821308313084130851308613087130881308913090130911309213093130941309513096130971309813099131001310113102131031310413105131061310713108131091311013111131121311313114131151311613117131181311913120131211312213123131241312513126131271312813129131301313113132131331313413135131361313713138131391314013141131421314313144131451314613147131481314913150131511315213153131541315513156131571315813159131601316113162131631316413165131661316713168131691317013171131721317313174131751317613177131781317913180131811318213183131841318513186131871318813189131901319113192131931319413195131961319713198131991320013201132021320313204132051320613207132081320913210132111321213213132141321513216132171321813219132201322113222132231322413225132261322713228132291323013231132321323313234132351323613237132381323913240132411324213243132441324513246132471324813249132501325113252132531325413255132561325713258132591326013261132621326313264132651326613267132681326913270132711327213273132741327513276132771327813279132801328113282132831328413285132861328713288132891329013291132921329313294132951329613297132981329913300133011330213303133041330513306133071330813309133101331113312133131331413315133161331713318133191332013321133221332313324133251332613327133281332913330133311333213333133341333513336133371333813339133401334113342133431334413345133461334713348133491335013351133521335313354133551335613357133581335913360133611336213363133641336513366133671336813369133701337113372133731337413375133761337713378133791338013381133821338313384133851338613387133881338913390133911339213393133941339513396133971339813399134001340113402134031340413405134061340713408134091341013411134121341313414134151341613417134181341913420134211342213423134241342513426134271342813429134301343113432134331343413435134361343713438134391344013441134421344313444134451344613447134481344913450134511345213453134541345513456134571345813459134601346113462134631346413465134661346713468134691347013471134721347313474134751347613477134781347913480134811348213483134841348513486134871348813489134901349113492134931349413495134961349713498134991350013501135021350313504135051350613507135081350913510135111351213513135141351513516135171351813519135201352113522135231352413525135261352713528135291353013531135321353313534135351353613537135381353913540135411354213543135441354513546135471354813549135501355113552135531355413555135561355713558135591356013561135621356313564135651356613567135681356913570135711357213573135741357513576135771357813579135801358113582135831358413585135861358713588135891359013591135921359313594135951359613597135981359913600136011360213603136041360513606136071360813609136101361113612136131361413615136161361713618136191362013621136221362313624136251362613627136281362913630136311363213633136341363513636136371363813639136401364113642136431364413645136461364713648136491365013651136521365313654136551365613657136581365913660136611366213663136641366513666136671366813669136701367113672136731367413675136761367713678136791368013681136821368313684136851368613687136881368913690136911369213693136941369513696136971369813699137001370113702137031370413705137061370713708137091371013711137121371313714137151371613717137181371913720137211372213723137241372513726137271372813729137301373113732137331373413735137361373713738137391374013741137421374313744137451374613747137481374913750137511375213753137541375513756137571375813759137601376113762137631376413765137661376713768137691377013771137721377313774137751377613777137781377913780137811378213783137841378513786137871378813789137901379113792137931379413795137961379713798137991380013801138021380313804138051380613807138081380913810138111381213813138141381513816138171381813819138201382113822138231382413825138261382713828138291383013831138321383313834138351383613837138381383913840138411384213843138441384513846138471384813849138501385113852138531385413855138561385713858138591386013861138621386313864138651386613867138681386913870138711387213873138741387513876138771387813879138801388113882138831388413885138861388713888138891389013891138921389313894138951389613897138981389913900139011390213903139041390513906139071390813909139101391113912139131391413915139161391713918139191392013921139221392313924139251392613927139281392913930139311393213933139341393513936139371393813939139401394113942139431394413945139461394713948139491395013951139521395313954139551395613957139581395913960139611396213963139641396513966139671396813969139701397113972139731397413975139761397713978139791398013981139821398313984139851398613987139881398913990139911399213993139941399513996139971399813999140001400114002140031400414005140061400714008140091401014011140121401314014140151401614017140181401914020140211402214023140241402514026140271402814029140301403114032140331403414035140361403714038140391404014041140421404314044140451404614047140481404914050140511405214053140541405514056140571405814059140601406114062140631406414065140661406714068140691407014071140721407314074140751407614077140781407914080140811408214083140841408514086140871408814089140901409114092140931409414095140961409714098140991410014101141021410314104141051410614107141081410914110141111411214113141141411514116141171411814119141201412114122141231412414125141261412714128141291413014131141321413314134141351413614137141381413914140141411414214143141441414514146141471414814149141501415114152141531415414155141561415714158141591416014161141621416314164141651416614167141681416914170141711417214173141741417514176141771417814179141801418114182141831418414185141861418714188141891419014191141921419314194141951419614197141981419914200142011420214203142041420514206142071420814209142101421114212142131421414215142161421714218142191422014221142221422314224142251422614227142281422914230142311423214233142341423514236142371423814239142401424114242142431424414245142461424714248142491425014251142521425314254142551425614257142581425914260142611426214263142641426514266142671426814269142701427114272142731427414275142761427714278142791428014281142821428314284142851428614287142881428914290142911429214293142941429514296142971429814299143001430114302143031430414305143061430714308143091431014311143121431314314143151431614317143181431914320143211432214323143241432514326143271432814329143301433114332143331433414335143361433714338143391434014341143421434314344143451434614347143481434914350143511435214353143541435514356143571435814359143601436114362143631436414365143661436714368143691437014371143721437314374143751437614377143781437914380143811438214383143841438514386143871438814389143901439114392143931439414395143961439714398143991440014401144021440314404144051440614407144081440914410144111441214413144141441514416144171441814419144201442114422144231442414425144261442714428144291443014431144321443314434144351443614437144381443914440144411444214443144441444514446144471444814449144501445114452144531445414455144561445714458144591446014461144621446314464144651446614467144681446914470144711447214473144741447514476144771447814479144801448114482144831448414485144861448714488144891449014491144921449314494144951449614497144981449914500145011450214503145041450514506145071450814509145101451114512145131451414515145161451714518145191452014521145221452314524145251452614527145281452914530145311453214533145341453514536145371453814539145401454114542145431454414545145461454714548145491455014551145521455314554145551455614557145581455914560145611456214563145641456514566145671456814569145701457114572145731457414575145761457714578145791458014581145821458314584145851458614587145881458914590145911459214593145941459514596145971459814599146001460114602146031460414605146061460714608146091461014611146121461314614146151461614617146181461914620146211462214623146241462514626146271462814629146301463114632146331463414635146361463714638146391464014641146421464314644146451464614647146481464914650146511465214653146541465514656146571465814659146601466114662146631466414665146661466714668146691467014671146721467314674146751467614677146781467914680146811468214683146841468514686146871468814689146901469114692146931469414695146961469714698146991470014701147021470314704147051470614707147081470914710147111471214713147141471514716147171471814719147201472114722147231472414725147261472714728147291473014731147321473314734147351473614737147381473914740147411474214743147441474514746147471474814749147501475114752147531475414755147561475714758147591476014761147621476314764147651476614767147681476914770147711477214773147741477514776147771477814779147801478114782147831478414785147861478714788147891479014791147921479314794147951479614797147981479914800148011480214803148041480514806148071480814809148101481114812148131481414815148161481714818148191482014821148221482314824148251482614827148281482914830148311483214833148341483514836148371483814839148401484114842148431484414845148461484714848148491485014851148521485314854148551485614857148581485914860148611486214863148641486514866148671486814869148701487114872148731487414875148761487714878148791488014881148821488314884148851488614887148881488914890148911489214893148941489514896148971489814899149001490114902149031490414905149061490714908149091491014911149121491314914149151491614917149181491914920149211492214923149241492514926149271492814929149301493114932149331493414935149361493714938149391494014941149421494314944149451494614947149481494914950149511495214953149541495514956149571495814959149601496114962149631496414965149661496714968149691497014971149721497314974149751497614977149781497914980149811498214983149841498514986149871498814989149901499114992149931499414995149961499714998149991500015001150021500315004150051500615007150081500915010150111501215013150141501515016150171501815019150201502115022150231502415025150261502715028150291503015031150321503315034150351503615037150381503915040150411504215043150441504515046150471504815049150501505115052150531505415055150561505715058150591506015061150621506315064150651506615067150681506915070150711507215073150741507515076150771507815079150801508115082150831508415085150861508715088150891509015091150921509315094150951509615097150981509915100151011510215103151041510515106151071510815109151101511115112151131511415115151161511715118151191512015121151221512315124151251512615127151281512915130151311513215133151341513515136151371513815139151401514115142151431514415145151461514715148151491515015151151521515315154151551515615157151581515915160151611516215163151641516515166151671516815169151701517115172151731517415175151761517715178151791518015181151821518315184151851518615187151881518915190151911519215193151941519515196151971519815199152001520115202152031520415205152061520715208152091521015211152121521315214152151521615217152181521915220152211522215223152241522515226152271522815229152301523115232152331523415235152361523715238152391524015241152421524315244152451524615247152481524915250152511525215253152541525515256152571525815259152601526115262152631526415265152661526715268152691527015271152721527315274152751527615277152781527915280152811528215283152841528515286152871528815289152901529115292152931529415295152961529715298152991530015301153021530315304153051530615307153081530915310153111531215313153141531515316153171531815319153201532115322153231532415325153261532715328153291533015331153321533315334153351533615337153381533915340153411534215343153441534515346153471534815349153501535115352153531535415355153561535715358153591536015361153621536315364153651536615367153681536915370153711537215373153741537515376153771537815379153801538115382153831538415385153861538715388153891539015391153921539315394153951539615397153981539915400154011540215403154041540515406154071540815409154101541115412154131541415415154161541715418154191542015421154221542315424154251542615427154281542915430154311543215433154341543515436154371543815439154401544115442154431544415445154461544715448154491545015451154521545315454154551545615457154581545915460154611546215463154641546515466154671546815469154701547115472154731547415475154761547715478154791548015481154821548315484154851548615487154881548915490154911549215493154941549515496154971549815499155001550115502155031550415505155061550715508155091551015511155121551315514155151551615517155181551915520155211552215523155241552515526155271552815529155301553115532155331553415535155361553715538155391554015541155421554315544155451554615547155481554915550155511555215553155541555515556155571555815559155601556115562155631556415565155661556715568155691557015571155721557315574155751557615577155781557915580155811558215583155841558515586155871558815589155901559115592155931559415595155961559715598155991560015601156021560315604156051560615607156081560915610156111561215613156141561515616156171561815619156201562115622156231562415625156261562715628156291563015631156321563315634156351563615637156381563915640156411564215643156441564515646156471564815649156501565115652156531565415655156561565715658156591566015661156621566315664156651566615667156681566915670156711567215673156741567515676156771567815679156801568115682156831568415685156861568715688156891569015691156921569315694156951569615697156981569915700157011570215703157041570515706157071570815709157101571115712157131571415715157161571715718157191572015721157221572315724157251572615727157281572915730157311573215733157341573515736157371573815739157401574115742157431574415745157461574715748157491575015751157521575315754157551575615757157581575915760157611576215763157641576515766157671576815769157701577115772157731577415775157761577715778157791578015781157821578315784157851578615787157881578915790157911579215793157941579515796157971579815799158001580115802158031580415805158061580715808158091581015811158121581315814158151581615817158181581915820158211582215823158241582515826158271582815829158301583115832158331583415835158361583715838158391584015841158421584315844158451584615847158481584915850158511585215853158541585515856158571585815859158601586115862158631586415865158661586715868158691587015871158721587315874158751587615877158781587915880158811588215883158841588515886158871588815889158901589115892158931589415895158961589715898158991590015901159021590315904159051590615907159081590915910159111591215913159141591515916159171591815919159201592115922159231592415925159261592715928159291593015931159321593315934159351593615937159381593915940159411594215943159441594515946159471594815949159501595115952159531595415955159561595715958159591596015961159621596315964159651596615967159681596915970159711597215973159741597515976159771597815979159801598115982159831598415985159861598715988159891599015991159921599315994159951599615997159981599916000160011600216003160041600516006160071600816009160101601116012160131601416015160161601716018160191602016021160221602316024160251602616027160281602916030160311603216033160341603516036160371603816039160401604116042160431604416045160461604716048160491605016051160521605316054160551605616057160581605916060160611606216063160641606516066160671606816069160701607116072160731607416075160761607716078160791608016081160821608316084160851608616087160881608916090160911609216093160941609516096160971609816099161001610116102161031610416105161061610716108161091611016111161121611316114161151611616117161181611916120161211612216123161241612516126161271612816129161301613116132161331613416135161361613716138161391614016141161421614316144161451614616147161481614916150161511615216153161541615516156161571615816159161601616116162161631616416165161661616716168161691617016171161721617316174161751617616177161781617916180161811618216183161841618516186161871618816189161901619116192161931619416195161961619716198161991620016201162021620316204162051620616207162081620916210162111621216213162141621516216162171621816219162201622116222162231622416225162261622716228162291623016231162321623316234162351623616237162381623916240162411624216243162441624516246162471624816249162501625116252162531625416255162561625716258162591626016261162621626316264162651626616267162681626916270162711627216273162741627516276162771627816279162801628116282162831628416285162861628716288162891629016291162921629316294162951629616297162981629916300163011630216303163041630516306163071630816309163101631116312163131631416315163161631716318163191632016321163221632316324163251632616327163281632916330163311633216333163341633516336163371633816339163401634116342163431634416345163461634716348163491635016351163521635316354163551635616357163581635916360163611636216363163641636516366163671636816369163701637116372163731637416375163761637716378163791638016381163821638316384163851638616387163881638916390163911639216393163941639516396163971639816399164001640116402164031640416405164061640716408164091641016411164121641316414164151641616417164181641916420164211642216423164241642516426164271642816429164301643116432164331643416435164361643716438164391644016441164421644316444164451644616447164481644916450164511645216453164541645516456164571645816459164601646116462164631646416465164661646716468164691647016471164721647316474164751647616477164781647916480164811648216483164841648516486164871648816489164901649116492164931649416495164961649716498164991650016501165021650316504165051650616507165081650916510165111651216513165141651516516165171651816519165201652116522165231652416525165261652716528165291653016531165321653316534165351653616537165381653916540165411654216543165441654516546165471654816549165501655116552165531655416555165561655716558165591656016561165621656316564165651656616567165681656916570165711657216573165741657516576165771657816579165801658116582165831658416585165861658716588165891659016591165921659316594165951659616597165981659916600166011660216603166041660516606166071660816609166101661116612166131661416615166161661716618166191662016621166221662316624166251662616627166281662916630166311663216633166341663516636166371663816639166401664116642166431664416645166461664716648166491665016651166521665316654166551665616657166581665916660166611666216663166641666516666166671666816669166701667116672166731667416675166761667716678166791668016681166821668316684166851668616687166881668916690166911669216693166941669516696166971669816699167001670116702167031670416705167061670716708167091671016711167121671316714167151671616717167181671916720167211672216723167241672516726167271672816729167301673116732167331673416735167361673716738167391674016741167421674316744167451674616747167481674916750167511675216753167541675516756167571675816759167601676116762167631676416765167661676716768167691677016771167721677316774167751677616777167781677916780167811678216783167841678516786167871678816789167901679116792167931679416795167961679716798167991680016801168021680316804168051680616807168081680916810168111681216813168141681516816168171681816819168201682116822168231682416825168261682716828168291683016831168321683316834168351683616837168381683916840168411684216843168441684516846168471684816849168501685116852168531685416855168561685716858168591686016861168621686316864168651686616867168681686916870168711687216873168741687516876168771687816879168801688116882168831688416885168861688716888168891689016891168921689316894168951689616897168981689916900169011690216903169041690516906169071690816909169101691116912169131691416915169161691716918169191692016921169221692316924169251692616927169281692916930169311693216933169341693516936169371693816939169401694116942169431694416945169461694716948169491695016951169521695316954169551695616957169581695916960169611696216963169641696516966169671696816969169701697116972169731697416975169761697716978169791698016981169821698316984169851698616987169881698916990169911699216993169941699516996169971699816999170001700117002170031700417005170061700717008170091701017011170121701317014170151701617017170181701917020170211702217023170241702517026170271702817029170301703117032170331703417035170361703717038170391704017041170421704317044170451704617047170481704917050170511705217053170541705517056170571705817059170601706117062170631706417065170661706717068170691707017071170721707317074170751707617077170781707917080170811708217083170841708517086170871708817089170901709117092170931709417095170961709717098170991710017101171021710317104171051710617107171081710917110171111711217113171141711517116171171711817119171201712117122171231712417125171261712717128171291713017131171321713317134171351713617137171381713917140171411714217143171441714517146171471714817149171501715117152171531715417155171561715717158171591716017161171621716317164171651716617167171681716917170171711717217173171741717517176171771717817179171801718117182171831718417185171861718717188171891719017191171921719317194171951719617197171981719917200172011720217203172041720517206172071720817209172101721117212172131721417215172161721717218172191722017221172221722317224172251722617227172281722917230172311723217233172341723517236172371723817239172401724117242172431724417245172461724717248172491725017251172521725317254172551725617257172581725917260172611726217263172641726517266172671726817269172701727117272172731727417275172761727717278172791728017281172821728317284172851728617287172881728917290172911729217293172941729517296172971729817299173001730117302173031730417305173061730717308173091731017311173121731317314173151731617317173181731917320173211732217323173241732517326173271732817329173301733117332173331733417335173361733717338173391734017341173421734317344173451734617347173481734917350173511735217353173541735517356173571735817359173601736117362173631736417365173661736717368173691737017371173721737317374173751737617377173781737917380173811738217383173841738517386173871738817389173901739117392173931739417395173961739717398173991740017401174021740317404174051740617407174081740917410174111741217413174141741517416174171741817419174201742117422174231742417425174261742717428174291743017431174321743317434174351743617437174381743917440174411744217443174441744517446174471744817449174501745117452174531745417455174561745717458174591746017461174621746317464174651746617467174681746917470174711747217473174741747517476174771747817479174801748117482174831748417485174861748717488174891749017491174921749317494174951749617497174981749917500175011750217503175041750517506175071750817509175101751117512175131751417515175161751717518175191752017521175221752317524175251752617527175281752917530175311753217533175341753517536175371753817539175401754117542175431754417545175461754717548175491755017551175521755317554175551755617557175581755917560175611756217563175641756517566175671756817569175701757117572175731757417575175761757717578175791758017581175821758317584175851758617587175881758917590175911759217593175941759517596175971759817599176001760117602176031760417605176061760717608176091761017611176121761317614176151761617617176181761917620176211762217623176241762517626176271762817629176301763117632176331763417635176361763717638176391764017641176421764317644176451764617647176481764917650176511765217653176541765517656176571765817659176601766117662176631766417665176661766717668176691767017671176721767317674176751767617677176781767917680176811768217683176841768517686176871768817689176901769117692176931769417695176961769717698176991770017701177021770317704177051770617707177081770917710177111771217713177141771517716177171771817719177201772117722177231772417725177261772717728177291773017731177321773317734177351773617737177381773917740177411774217743177441774517746177471774817749177501775117752177531775417755177561775717758177591776017761177621776317764177651776617767177681776917770177711777217773177741777517776177771777817779177801778117782177831778417785177861778717788177891779017791177921779317794177951779617797177981779917800178011780217803178041780517806178071780817809178101781117812178131781417815178161781717818178191782017821178221782317824178251782617827178281782917830178311783217833178341783517836178371783817839178401784117842178431784417845178461784717848178491785017851178521785317854178551785617857178581785917860178611786217863178641786517866178671786817869178701787117872178731787417875178761787717878178791788017881178821788317884178851788617887178881788917890178911789217893178941789517896178971789817899179001790117902179031790417905179061790717908179091791017911179121791317914179151791617917179181791917920179211792217923179241792517926179271792817929179301793117932179331793417935179361793717938179391794017941179421794317944179451794617947179481794917950179511795217953179541795517956179571795817959179601796117962179631796417965179661796717968179691797017971179721797317974179751797617977179781797917980179811798217983179841798517986179871798817989179901799117992179931799417995179961799717998179991800018001180021800318004180051800618007180081800918010180111801218013180141801518016180171801818019180201802118022180231802418025180261802718028180291803018031180321803318034180351803618037180381803918040180411804218043180441804518046180471804818049180501805118052180531805418055180561805718058180591806018061180621806318064180651806618067180681806918070180711807218073180741807518076180771807818079180801808118082180831808418085180861808718088180891809018091180921809318094180951809618097180981809918100181011810218103181041810518106181071810818109181101811118112181131811418115181161811718118181191812018121181221812318124181251812618127181281812918130181311813218133181341813518136181371813818139181401814118142181431814418145181461814718148181491815018151181521815318154181551815618157181581815918160181611816218163181641816518166181671816818169181701817118172181731817418175181761817718178181791818018181181821818318184181851818618187181881818918190181911819218193181941819518196181971819818199182001820118202182031820418205182061820718208182091821018211182121821318214182151821618217182181821918220182211822218223182241822518226182271822818229182301823118232182331823418235182361823718238182391824018241182421824318244182451824618247182481824918250182511825218253182541825518256182571825818259182601826118262182631826418265182661826718268182691827018271182721827318274182751827618277182781827918280182811828218283182841828518286182871828818289182901829118292182931829418295182961829718298182991830018301183021830318304183051830618307183081830918310183111831218313183141831518316183171831818319183201832118322183231832418325183261832718328183291833018331183321833318334183351833618337183381833918340183411834218343183441834518346183471834818349183501835118352183531835418355183561835718358183591836018361183621836318364183651836618367183681836918370183711837218373183741837518376183771837818379183801838118382183831838418385183861838718388183891839018391183921839318394183951839618397183981839918400184011840218403184041840518406184071840818409184101841118412184131841418415184161841718418184191842018421184221842318424184251842618427184281842918430184311843218433184341843518436184371843818439184401844118442184431844418445184461844718448184491845018451184521845318454184551845618457184581845918460184611846218463184641846518466184671846818469184701847118472184731847418475184761847718478184791848018481184821848318484184851848618487184881848918490184911849218493184941849518496184971849818499185001850118502185031850418505185061850718508185091851018511185121851318514185151851618517185181851918520185211852218523185241852518526185271852818529185301853118532185331853418535185361853718538185391854018541185421854318544185451854618547185481854918550185511855218553185541855518556185571855818559185601856118562185631856418565185661856718568185691857018571185721857318574185751857618577185781857918580185811858218583185841858518586185871858818589185901859118592185931859418595185961859718598185991860018601186021860318604186051860618607186081860918610186111861218613186141861518616186171861818619186201862118622186231862418625186261862718628186291863018631186321863318634186351863618637186381863918640186411864218643186441864518646186471864818649186501865118652186531865418655186561865718658186591866018661186621866318664186651866618667186681866918670186711867218673186741867518676186771867818679186801868118682186831868418685186861868718688186891869018691186921869318694186951869618697186981869918700187011870218703187041870518706187071870818709187101871118712187131871418715187161871718718187191872018721187221872318724187251872618727187281872918730187311873218733187341873518736187371873818739187401874118742187431874418745187461874718748187491875018751187521875318754187551875618757187581875918760187611876218763187641876518766187671876818769187701877118772187731877418775187761877718778187791878018781187821878318784187851878618787187881878918790187911879218793187941879518796187971879818799188001880118802188031880418805188061880718808188091881018811188121881318814188151881618817188181881918820188211882218823188241882518826188271882818829188301883118832188331883418835188361883718838188391884018841188421884318844188451884618847188481884918850188511885218853188541885518856188571885818859188601886118862188631886418865188661886718868188691887018871188721887318874188751887618877188781887918880188811888218883188841888518886188871888818889188901889118892188931889418895188961889718898188991890018901189021890318904189051890618907189081890918910189111891218913189141891518916189171891818919189201892118922189231892418925189261892718928189291893018931189321893318934189351893618937189381893918940189411894218943189441894518946189471894818949189501895118952189531895418955189561895718958189591896018961189621896318964189651896618967189681896918970189711897218973189741897518976189771897818979189801898118982189831898418985189861898718988189891899018991189921899318994189951899618997189981899919000190011900219003190041900519006190071900819009190101901119012190131901419015190161901719018190191902019021190221902319024190251902619027190281902919030190311903219033190341903519036190371903819039190401904119042190431904419045190461904719048190491905019051190521905319054190551905619057190581905919060190611906219063190641906519066190671906819069190701907119072190731907419075190761907719078190791908019081190821908319084190851908619087190881908919090190911909219093190941909519096190971909819099191001910119102191031910419105191061910719108191091911019111191121911319114191151911619117191181911919120191211912219123191241912519126191271912819129191301913119132191331913419135191361913719138191391914019141191421914319144191451914619147191481914919150191511915219153191541915519156191571915819159191601916119162191631916419165191661916719168191691917019171191721917319174191751917619177191781917919180191811918219183191841918519186191871918819189191901919119192191931919419195191961919719198191991920019201192021920319204192051920619207192081920919210192111921219213192141921519216192171921819219192201922119222192231922419225192261922719228192291923019231192321923319234192351923619237192381923919240192411924219243192441924519246192471924819249192501925119252192531925419255192561925719258192591926019261192621926319264192651926619267192681926919270192711927219273192741927519276192771927819279192801928119282192831928419285192861928719288192891929019291192921929319294192951929619297192981929919300193011930219303193041930519306193071930819309193101931119312193131931419315193161931719318193191932019321193221932319324193251932619327193281932919330193311933219333193341933519336193371933819339193401934119342193431934419345193461934719348193491935019351193521935319354193551935619357193581935919360193611936219363193641936519366193671936819369193701937119372193731937419375193761937719378193791938019381193821938319384193851938619387193881938919390193911939219393193941939519396193971939819399194001940119402194031940419405194061940719408194091941019411194121941319414194151941619417194181941919420194211942219423194241942519426194271942819429194301943119432194331943419435194361943719438194391944019441194421944319444194451944619447194481944919450194511945219453194541945519456194571945819459194601946119462194631946419465194661946719468194691947019471194721947319474194751947619477194781947919480194811948219483194841948519486194871948819489194901949119492194931949419495194961949719498194991950019501195021950319504195051950619507195081950919510195111951219513195141951519516195171951819519195201952119522195231952419525195261952719528195291953019531195321953319534195351953619537195381953919540195411954219543195441954519546195471954819549195501955119552195531955419555195561955719558195591956019561195621956319564195651956619567195681956919570195711957219573195741957519576195771957819579195801958119582195831958419585195861958719588195891959019591195921959319594195951959619597195981959919600196011960219603196041960519606196071960819609196101961119612196131961419615196161961719618196191962019621196221962319624196251962619627196281962919630196311963219633196341963519636196371963819639196401964119642196431964419645196461964719648196491965019651196521965319654196551965619657196581965919660196611966219663196641966519666196671966819669196701967119672196731967419675196761967719678196791968019681196821968319684196851968619687196881968919690196911969219693196941969519696196971969819699197001970119702197031970419705197061970719708197091971019711197121971319714197151971619717197181971919720197211972219723197241972519726197271972819729197301973119732197331973419735197361973719738197391974019741197421974319744197451974619747197481974919750197511975219753197541975519756197571975819759197601976119762197631976419765197661976719768197691977019771197721977319774197751977619777197781977919780197811978219783197841978519786197871978819789197901979119792197931979419795197961979719798197991980019801198021980319804198051980619807198081980919810198111981219813198141981519816198171981819819198201982119822198231982419825198261982719828198291983019831198321983319834198351983619837198381983919840198411984219843198441984519846198471984819849198501985119852198531985419855198561985719858198591986019861198621986319864198651986619867198681986919870198711987219873198741987519876198771987819879198801988119882198831988419885198861988719888198891989019891198921989319894198951989619897198981989919900199011990219903199041990519906199071990819909199101991119912199131991419915199161991719918199191992019921199221992319924199251992619927199281992919930199311993219933199341993519936199371993819939199401994119942199431994419945199461994719948199491995019951199521995319954199551995619957199581995919960199611996219963199641996519966199671996819969199701997119972199731997419975199761997719978199791998019981199821998319984199851998619987199881998919990199911999219993199941999519996199971999819999200002000120002200032000420005200062000720008200092001020011200122001320014200152001620017200182001920020200212002220023200242002520026200272002820029200302003120032200332003420035200362003720038200392004020041200422004320044200452004620047200482004920050200512005220053200542005520056200572005820059200602006120062200632006420065200662006720068200692007020071200722007320074200752007620077200782007920080200812008220083200842008520086200872008820089200902009120092200932009420095200962009720098200992010020101201022010320104201052010620107201082010920110201112011220113201142011520116201172011820119201202012120122201232012420125201262012720128201292013020131201322013320134201352013620137201382013920140201412014220143201442014520146201472014820149201502015120152201532015420155201562015720158201592016020161201622016320164201652016620167201682016920170201712017220173201742017520176201772017820179201802018120182201832018420185201862018720188201892019020191201922019320194201952019620197201982019920200202012020220203202042020520206202072020820209202102021120212202132021420215202162021720218202192022020221202222022320224202252022620227202282022920230202312023220233202342023520236202372023820239202402024120242202432024420245202462024720248202492025020251202522025320254202552025620257202582025920260202612026220263202642026520266202672026820269202702027120272202732027420275202762027720278202792028020281202822028320284202852028620287202882028920290202912029220293202942029520296202972029820299203002030120302203032030420305203062030720308203092031020311203122031320314203152031620317203182031920320203212032220323203242032520326203272032820329203302033120332203332033420335203362033720338203392034020341203422034320344203452034620347203482034920350203512035220353203542035520356203572035820359203602036120362203632036420365203662036720368203692037020371203722037320374203752037620377203782037920380203812038220383203842038520386203872038820389203902039120392203932039420395203962039720398203992040020401204022040320404204052040620407204082040920410204112041220413204142041520416204172041820419204202042120422204232042420425204262042720428204292043020431204322043320434204352043620437204382043920440204412044220443204442044520446204472044820449204502045120452204532045420455204562045720458204592046020461204622046320464204652046620467204682046920470204712047220473204742047520476204772047820479204802048120482204832048420485204862048720488204892049020491204922049320494204952049620497204982049920500205012050220503205042050520506205072050820509205102051120512205132051420515205162051720518205192052020521205222052320524205252052620527205282052920530205312053220533205342053520536205372053820539205402054120542205432054420545205462054720548205492055020551205522055320554205552055620557205582055920560205612056220563205642056520566205672056820569205702057120572205732057420575205762057720578205792058020581205822058320584205852058620587205882058920590205912059220593205942059520596205972059820599206002060120602206032060420605206062060720608206092061020611206122061320614206152061620617206182061920620206212062220623206242062520626206272062820629206302063120632206332063420635206362063720638206392064020641206422064320644206452064620647206482064920650206512065220653206542065520656206572065820659206602066120662206632066420665206662066720668206692067020671206722067320674206752067620677206782067920680206812068220683206842068520686206872068820689206902069120692206932069420695206962069720698206992070020701207022070320704207052070620707207082070920710207112071220713207142071520716207172071820719207202072120722207232072420725207262072720728207292073020731207322073320734207352073620737207382073920740207412074220743207442074520746207472074820749207502075120752207532075420755207562075720758207592076020761207622076320764207652076620767207682076920770207712077220773207742077520776207772077820779207802078120782207832078420785207862078720788207892079020791207922079320794207952079620797207982079920800208012080220803208042080520806208072080820809208102081120812208132081420815208162081720818208192082020821208222082320824208252082620827208282082920830208312083220833208342083520836208372083820839208402084120842208432084420845208462084720848208492085020851208522085320854208552085620857208582085920860208612086220863208642086520866208672086820869208702087120872208732087420875208762087720878208792088020881208822088320884208852088620887208882088920890208912089220893208942089520896208972089820899209002090120902209032090420905209062090720908209092091020911209122091320914209152091620917209182091920920209212092220923209242092520926209272092820929209302093120932209332093420935209362093720938209392094020941209422094320944209452094620947209482094920950209512095220953209542095520956209572095820959209602096120962209632096420965209662096720968209692097020971209722097320974209752097620977209782097920980209812098220983209842098520986209872098820989209902099120992209932099420995209962099720998209992100021001210022100321004210052100621007210082100921010210112101221013210142101521016210172101821019210202102121022210232102421025210262102721028210292103021031210322103321034210352103621037210382103921040210412104221043210442104521046210472104821049210502105121052210532105421055210562105721058210592106021061210622106321064210652106621067210682106921070210712107221073210742107521076210772107821079210802108121082210832108421085210862108721088210892109021091210922109321094210952109621097210982109921100211012110221103211042110521106211072110821109211102111121112211132111421115211162111721118211192112021121211222112321124211252112621127211282112921130211312113221133211342113521136211372113821139211402114121142211432114421145211462114721148211492115021151211522115321154211552115621157211582115921160211612116221163211642116521166211672116821169211702117121172211732117421175211762117721178211792118021181211822118321184211852118621187211882118921190211912119221193211942119521196211972119821199212002120121202212032120421205212062120721208212092121021211212122121321214212152121621217212182121921220212212122221223212242122521226212272122821229212302123121232212332123421235212362123721238212392124021241212422124321244212452124621247212482124921250212512125221253212542125521256212572125821259212602126121262212632126421265212662126721268212692127021271212722127321274212752127621277212782127921280212812128221283212842128521286212872128821289212902129121292212932129421295212962129721298212992130021301213022130321304213052130621307213082130921310213112131221313213142131521316213172131821319213202132121322213232132421325213262132721328213292133021331213322133321334213352133621337213382133921340213412134221343213442134521346213472134821349213502135121352213532135421355213562135721358213592136021361213622136321364213652136621367213682136921370213712137221373213742137521376213772137821379213802138121382213832138421385213862138721388213892139021391213922139321394213952139621397213982139921400214012140221403214042140521406214072140821409214102141121412214132141421415214162141721418214192142021421214222142321424214252142621427214282142921430214312143221433214342143521436214372143821439214402144121442214432144421445214462144721448214492145021451214522145321454214552145621457214582145921460214612146221463214642146521466214672146821469214702147121472214732147421475214762147721478214792148021481214822148321484214852148621487214882148921490214912149221493214942149521496214972149821499215002150121502215032150421505215062150721508215092151021511215122151321514215152151621517215182151921520215212152221523215242152521526215272152821529215302153121532215332153421535215362153721538215392154021541215422154321544215452154621547215482154921550215512155221553215542155521556215572155821559215602156121562215632156421565215662156721568215692157021571215722157321574215752157621577215782157921580215812158221583215842158521586215872158821589215902159121592215932159421595215962159721598215992160021601216022160321604216052160621607216082160921610216112161221613216142161521616216172161821619216202162121622216232162421625216262162721628216292163021631216322163321634216352163621637216382163921640216412164221643216442164521646216472164821649216502165121652216532165421655216562165721658216592166021661216622166321664216652166621667216682166921670216712167221673216742167521676216772167821679216802168121682216832168421685216862168721688216892169021691216922169321694216952169621697216982169921700217012170221703217042170521706217072170821709217102171121712217132171421715217162171721718217192172021721217222172321724217252172621727217282172921730217312173221733217342173521736217372173821739217402174121742217432174421745217462174721748217492175021751217522175321754217552175621757217582175921760217612176221763217642176521766217672176821769217702177121772217732177421775217762177721778217792178021781217822178321784217852178621787217882178921790217912179221793217942179521796217972179821799218002180121802218032180421805218062180721808218092181021811218122181321814218152181621817218182181921820218212182221823218242182521826218272182821829218302183121832218332183421835218362183721838218392184021841218422184321844218452184621847218482184921850218512185221853218542185521856218572185821859218602186121862218632186421865218662186721868218692187021871218722187321874218752187621877218782187921880218812188221883218842188521886218872188821889218902189121892218932189421895218962189721898218992190021901219022190321904219052190621907219082190921910219112191221913219142191521916219172191821919219202192121922219232192421925219262192721928219292193021931219322193321934219352193621937219382193921940219412194221943219442194521946219472194821949219502195121952219532195421955219562195721958219592196021961219622196321964219652196621967219682196921970219712197221973219742197521976219772197821979219802198121982219832198421985219862198721988219892199021991219922199321994219952199621997219982199922000220012200222003220042200522006220072200822009220102201122012220132201422015220162201722018220192202022021220222202322024220252202622027220282202922030220312203222033220342203522036220372203822039220402204122042220432204422045220462204722048220492205022051220522205322054220552205622057220582205922060220612206222063220642206522066220672206822069220702207122072220732207422075220762207722078220792208022081220822208322084220852208622087220882208922090220912209222093220942209522096220972209822099221002210122102221032210422105221062210722108221092211022111221122211322114221152211622117221182211922120221212212222123221242212522126221272212822129221302213122132221332213422135221362213722138221392214022141221422214322144221452214622147221482214922150221512215222153221542215522156221572215822159221602216122162221632216422165221662216722168221692217022171221722217322174221752217622177221782217922180221812218222183221842218522186221872218822189221902219122192221932219422195221962219722198221992220022201222022220322204222052220622207222082220922210222112221222213222142221522216222172221822219222202222122222222232222422225222262222722228222292223022231222322223322234222352223622237222382223922240222412224222243222442224522246222472224822249222502225122252222532225422255222562225722258222592226022261222622226322264222652226622267222682226922270222712227222273222742227522276222772227822279222802228122282222832228422285222862228722288222892229022291222922229322294222952229622297222982229922300223012230222303223042230522306223072230822309223102231122312223132231422315223162231722318223192232022321223222232322324223252232622327223282232922330223312233222333223342233522336223372233822339223402234122342223432234422345223462234722348223492235022351223522235322354223552235622357223582235922360223612236222363223642236522366223672236822369223702237122372223732237422375223762237722378223792238022381223822238322384223852238622387223882238922390223912239222393223942239522396223972239822399224002240122402224032240422405224062240722408224092241022411224122241322414224152241622417224182241922420224212242222423224242242522426224272242822429224302243122432224332243422435224362243722438224392244022441224422244322444224452244622447224482244922450224512245222453224542245522456224572245822459224602246122462224632246422465224662246722468224692247022471224722247322474224752247622477224782247922480224812248222483224842248522486224872248822489224902249122492224932249422495224962249722498224992250022501225022250322504225052250622507225082250922510225112251222513225142251522516225172251822519225202252122522225232252422525225262252722528225292253022531225322253322534225352253622537225382253922540225412254222543225442254522546225472254822549225502255122552225532255422555225562255722558225592256022561225622256322564225652256622567225682256922570225712257222573225742257522576225772257822579225802258122582225832258422585225862258722588225892259022591225922259322594225952259622597225982259922600226012260222603226042260522606226072260822609226102261122612226132261422615226162261722618226192262022621226222262322624226252262622627226282262922630226312263222633226342263522636226372263822639226402264122642226432264422645226462264722648226492265022651226522265322654226552265622657226582265922660226612266222663226642266522666226672266822669226702267122672226732267422675226762267722678226792268022681226822268322684226852268622687226882268922690226912269222693226942269522696226972269822699227002270122702227032270422705227062270722708227092271022711227122271322714227152271622717227182271922720227212272222723227242272522726227272272822729227302273122732227332273422735227362273722738227392274022741227422274322744227452274622747227482274922750227512275222753227542275522756227572275822759227602276122762227632276422765227662276722768227692277022771227722277322774227752277622777227782277922780227812278222783227842278522786227872278822789227902279122792227932279422795227962279722798227992280022801228022280322804228052280622807228082280922810228112281222813228142281522816228172281822819228202282122822228232282422825228262282722828228292283022831228322283322834228352283622837228382283922840228412284222843228442284522846228472284822849228502285122852228532285422855228562285722858228592286022861228622286322864228652286622867228682286922870228712287222873228742287522876228772287822879228802288122882228832288422885228862288722888228892289022891228922289322894228952289622897228982289922900229012290222903229042290522906229072290822909229102291122912229132291422915229162291722918229192292022921229222292322924229252292622927229282292922930229312293222933229342293522936229372293822939229402294122942229432294422945229462294722948229492295022951229522295322954229552295622957229582295922960229612296222963229642296522966229672296822969229702297122972229732297422975229762297722978229792298022981229822298322984229852298622987229882298922990229912299222993229942299522996229972299822999230002300123002230032300423005230062300723008230092301023011230122301323014230152301623017230182301923020230212302223023230242302523026230272302823029230302303123032230332303423035230362303723038230392304023041230422304323044230452304623047230482304923050230512305223053230542305523056230572305823059230602306123062230632306423065230662306723068230692307023071230722307323074230752307623077230782307923080230812308223083230842308523086230872308823089230902309123092230932309423095230962309723098230992310023101231022310323104231052310623107231082310923110231112311223113231142311523116231172311823119231202312123122231232312423125231262312723128231292313023131231322313323134231352313623137231382313923140231412314223143231442314523146231472314823149231502315123152231532315423155231562315723158231592316023161231622316323164231652316623167231682316923170231712317223173231742317523176231772317823179231802318123182231832318423185231862318723188231892319023191231922319323194231952319623197231982319923200232012320223203232042320523206232072320823209232102321123212232132321423215232162321723218232192322023221232222322323224232252322623227232282322923230232312323223233232342323523236232372323823239232402324123242232432324423245232462324723248232492325023251232522325323254232552325623257232582325923260232612326223263232642326523266232672326823269232702327123272232732327423275232762327723278232792328023281232822328323284232852328623287232882328923290232912329223293232942329523296232972329823299233002330123302233032330423305233062330723308233092331023311233122331323314233152331623317233182331923320233212332223323233242332523326233272332823329233302333123332233332333423335233362333723338233392334023341233422334323344233452334623347233482334923350233512335223353233542335523356233572335823359233602336123362233632336423365233662336723368233692337023371233722337323374233752337623377233782337923380233812338223383233842338523386233872338823389233902339123392233932339423395233962339723398233992340023401234022340323404234052340623407234082340923410234112341223413234142341523416234172341823419234202342123422234232342423425234262342723428234292343023431234322343323434234352343623437234382343923440234412344223443234442344523446234472344823449234502345123452234532345423455234562345723458234592346023461234622346323464234652346623467234682346923470234712347223473234742347523476234772347823479234802348123482234832348423485234862348723488234892349023491234922349323494234952349623497234982349923500235012350223503235042350523506235072350823509235102351123512235132351423515235162351723518235192352023521235222352323524235252352623527235282352923530235312353223533235342353523536235372353823539235402354123542235432354423545235462354723548235492355023551235522355323554235552355623557235582355923560235612356223563235642356523566235672356823569235702357123572235732357423575235762357723578235792358023581235822358323584235852358623587235882358923590235912359223593235942359523596235972359823599236002360123602236032360423605236062360723608236092361023611236122361323614236152361623617236182361923620236212362223623236242362523626236272362823629236302363123632236332363423635236362363723638236392364023641236422364323644236452364623647236482364923650236512365223653236542365523656236572365823659236602366123662236632366423665236662366723668236692367023671236722367323674236752367623677236782367923680236812368223683236842368523686236872368823689236902369123692236932369423695236962369723698236992370023701237022370323704237052370623707237082370923710237112371223713237142371523716237172371823719237202372123722237232372423725237262372723728237292373023731237322373323734237352373623737237382373923740237412374223743237442374523746237472374823749237502375123752237532375423755237562375723758237592376023761237622376323764237652376623767237682376923770237712377223773237742377523776237772377823779237802378123782237832378423785237862378723788237892379023791237922379323794237952379623797237982379923800238012380223803238042380523806238072380823809238102381123812238132381423815238162381723818238192382023821238222382323824238252382623827238282382923830238312383223833238342383523836238372383823839238402384123842238432384423845238462384723848238492385023851238522385323854238552385623857238582385923860238612386223863238642386523866238672386823869238702387123872238732387423875238762387723878238792388023881238822388323884238852388623887238882388923890238912389223893238942389523896238972389823899239002390123902239032390423905239062390723908239092391023911239122391323914239152391623917239182391923920239212392223923239242392523926239272392823929239302393123932239332393423935239362393723938239392394023941239422394323944239452394623947239482394923950239512395223953239542395523956239572395823959239602396123962239632396423965239662396723968239692397023971239722397323974239752397623977239782397923980239812398223983239842398523986239872398823989239902399123992239932399423995239962399723998239992400024001240022400324004240052400624007240082400924010240112401224013240142401524016240172401824019240202402124022240232402424025240262402724028240292403024031240322403324034240352403624037240382403924040240412404224043240442404524046240472404824049240502405124052240532405424055240562405724058240592406024061240622406324064240652406624067240682406924070240712407224073240742407524076240772407824079240802408124082240832408424085240862408724088240892409024091240922409324094240952409624097240982409924100241012410224103241042410524106241072410824109241102411124112241132411424115241162411724118241192412024121241222412324124241252412624127241282412924130241312413224133241342413524136241372413824139241402414124142241432414424145241462414724148241492415024151241522415324154241552415624157241582415924160241612416224163241642416524166241672416824169241702417124172241732417424175241762417724178241792418024181241822418324184241852418624187241882418924190241912419224193241942419524196241972419824199242002420124202242032420424205242062420724208242092421024211242122421324214242152421624217242182421924220242212422224223242242422524226242272422824229242302423124232242332423424235242362423724238242392424024241242422424324244242452424624247242482424924250242512425224253242542425524256242572425824259242602426124262242632426424265242662426724268242692427024271242722427324274242752427624277242782427924280242812428224283242842428524286242872428824289242902429124292242932429424295242962429724298242992430024301243022430324304243052430624307243082430924310243112431224313243142431524316243172431824319243202432124322243232432424325243262432724328243292433024331243322433324334243352433624337243382433924340243412434224343243442434524346243472434824349243502435124352243532435424355243562435724358243592436024361243622436324364243652436624367243682436924370243712437224373243742437524376243772437824379243802438124382243832438424385243862438724388243892439024391243922439324394243952439624397243982439924400244012440224403244042440524406244072440824409244102441124412244132441424415244162441724418244192442024421244222442324424244252442624427244282442924430244312443224433244342443524436244372443824439244402444124442244432444424445244462444724448244492445024451244522445324454244552445624457244582445924460244612446224463244642446524466244672446824469244702447124472244732447424475244762447724478244792448024481244822448324484244852448624487244882448924490244912449224493244942449524496244972449824499245002450124502245032450424505245062450724508245092451024511245122451324514245152451624517245182451924520245212452224523245242452524526245272452824529245302453124532245332453424535245362453724538245392454024541245422454324544245452454624547245482454924550245512455224553245542455524556245572455824559245602456124562245632456424565245662456724568245692457024571245722457324574245752457624577245782457924580245812458224583245842458524586245872458824589245902459124592245932459424595245962459724598245992460024601246022460324604246052460624607246082460924610246112461224613246142461524616246172461824619246202462124622246232462424625246262462724628246292463024631246322463324634246352463624637246382463924640246412464224643246442464524646246472464824649246502465124652246532465424655246562465724658246592466024661246622466324664246652466624667246682466924670246712467224673246742467524676246772467824679246802468124682246832468424685246862468724688246892469024691246922469324694246952469624697246982469924700247012470224703247042470524706247072470824709247102471124712247132471424715247162471724718247192472024721247222472324724247252472624727247282472924730247312473224733247342473524736247372473824739247402474124742247432474424745247462474724748247492475024751247522475324754247552475624757247582475924760247612476224763247642476524766247672476824769247702477124772247732477424775247762477724778247792478024781247822478324784247852478624787247882478924790247912479224793247942479524796247972479824799248002480124802248032480424805248062480724808248092481024811248122481324814248152481624817248182481924820248212482224823248242482524826248272482824829248302483124832248332483424835248362483724838248392484024841248422484324844248452484624847248482484924850248512485224853248542485524856248572485824859248602486124862248632486424865248662486724868248692487024871248722487324874248752487624877248782487924880248812488224883248842488524886248872488824889248902489124892248932489424895248962489724898248992490024901249022490324904249052490624907249082490924910249112491224913249142491524916249172491824919249202492124922249232492424925249262492724928249292493024931249322493324934249352493624937249382493924940249412494224943249442494524946249472494824949249502495124952249532495424955249562495724958249592496024961249622496324964249652496624967249682496924970249712497224973249742497524976249772497824979249802498124982249832498424985249862498724988249892499024991249922499324994249952499624997249982499925000250012500225003250042500525006250072500825009250102501125012250132501425015250162501725018250192502025021250222502325024250252502625027250282502925030250312503225033250342503525036250372503825039250402504125042250432504425045250462504725048250492505025051250522505325054250552505625057250582505925060250612506225063250642506525066250672506825069250702507125072250732507425075250762507725078250792508025081250822508325084250852508625087250882508925090250912509225093250942509525096250972509825099251002510125102251032510425105251062510725108251092511025111251122511325114251152511625117251182511925120251212512225123251242512525126251272512825129251302513125132251332513425135251362513725138251392514025141251422514325144251452514625147251482514925150251512515225153251542515525156251572515825159251602516125162251632516425165251662516725168251692517025171251722517325174251752517625177251782517925180251812518225183251842518525186251872518825189251902519125192251932519425195251962519725198251992520025201252022520325204252052520625207252082520925210252112521225213252142521525216252172521825219252202522125222252232522425225252262522725228252292523025231252322523325234252352523625237252382523925240252412524225243252442524525246252472524825249252502525125252252532525425255252562525725258252592526025261252622526325264252652526625267252682526925270252712527225273252742527525276252772527825279252802528125282252832528425285252862528725288252892529025291252922529325294252952529625297252982529925300253012530225303253042530525306253072530825309253102531125312253132531425315253162531725318253192532025321253222532325324253252532625327253282532925330253312533225333253342533525336253372533825339253402534125342253432534425345253462534725348253492535025351253522535325354253552535625357253582535925360253612536225363253642536525366253672536825369253702537125372253732537425375253762537725378253792538025381253822538325384253852538625387253882538925390253912539225393253942539525396253972539825399254002540125402254032540425405254062540725408254092541025411254122541325414254152541625417254182541925420254212542225423254242542525426254272542825429254302543125432254332543425435254362543725438254392544025441254422544325444254452544625447254482544925450254512545225453254542545525456254572545825459254602546125462254632546425465254662546725468254692547025471254722547325474254752547625477254782547925480254812548225483254842548525486254872548825489254902549125492254932549425495254962549725498254992550025501255022550325504255052550625507255082550925510255112551225513255142551525516255172551825519255202552125522255232552425525255262552725528255292553025531255322553325534255352553625537255382553925540255412554225543255442554525546255472554825549255502555125552255532555425555255562555725558255592556025561255622556325564255652556625567255682556925570255712557225573255742557525576255772557825579255802558125582255832558425585255862558725588255892559025591255922559325594255952559625597255982559925600256012560225603256042560525606256072560825609256102561125612256132561425615256162561725618256192562025621256222562325624256252562625627256282562925630256312563225633256342563525636256372563825639256402564125642256432564425645256462564725648256492565025651256522565325654256552565625657256582565925660256612566225663256642566525666256672566825669256702567125672256732567425675256762567725678256792568025681256822568325684256852568625687256882568925690256912569225693256942569525696256972569825699257002570125702257032570425705257062570725708257092571025711257122571325714257152571625717257182571925720257212572225723257242572525726257272572825729257302573125732257332573425735257362573725738257392574025741257422574325744257452574625747257482574925750257512575225753257542575525756257572575825759257602576125762257632576425765257662576725768257692577025771257722577325774257752577625777257782577925780257812578225783257842578525786257872578825789257902579125792257932579425795257962579725798257992580025801258022580325804258052580625807258082580925810258112581225813258142581525816258172581825819258202582125822258232582425825258262582725828258292583025831258322583325834258352583625837258382583925840258412584225843258442584525846258472584825849258502585125852258532585425855258562585725858258592586025861258622586325864258652586625867258682586925870258712587225873258742587525876258772587825879258802588125882258832588425885258862588725888258892589025891258922589325894258952589625897258982589925900259012590225903259042590525906259072590825909259102591125912259132591425915259162591725918259192592025921259222592325924259252592625927259282592925930259312593225933259342593525936259372593825939259402594125942259432594425945259462594725948259492595025951259522595325954259552595625957259582595925960259612596225963259642596525966259672596825969259702597125972259732597425975259762597725978259792598025981259822598325984259852598625987259882598925990259912599225993259942599525996259972599825999260002600126002260032600426005260062600726008260092601026011260122601326014260152601626017260182601926020260212602226023260242602526026260272602826029260302603126032260332603426035260362603726038260392604026041260422604326044260452604626047260482604926050260512605226053260542605526056260572605826059260602606126062260632606426065260662606726068260692607026071260722607326074260752607626077260782607926080260812608226083260842608526086260872608826089260902609126092260932609426095260962609726098260992610026101261022610326104261052610626107261082610926110261112611226113261142611526116261172611826119261202612126122261232612426125261262612726128261292613026131261322613326134261352613626137261382613926140261412614226143261442614526146261472614826149261502615126152261532615426155261562615726158261592616026161261622616326164261652616626167261682616926170261712617226173261742617526176261772617826179261802618126182261832618426185261862618726188261892619026191261922619326194261952619626197261982619926200262012620226203262042620526206262072620826209262102621126212262132621426215262162621726218262192622026221262222622326224262252622626227262282622926230262312623226233262342623526236262372623826239262402624126242262432624426245262462624726248262492625026251262522625326254262552625626257262582625926260262612626226263262642626526266262672626826269262702627126272262732627426275262762627726278262792628026281262822628326284262852628626287262882628926290262912629226293262942629526296262972629826299263002630126302263032630426305263062630726308263092631026311263122631326314263152631626317263182631926320263212632226323263242632526326263272632826329263302633126332263332633426335263362633726338263392634026341263422634326344263452634626347263482634926350263512635226353263542635526356263572635826359263602636126362263632636426365263662636726368263692637026371263722637326374263752637626377263782637926380263812638226383263842638526386263872638826389263902639126392263932639426395263962639726398263992640026401264022640326404264052640626407264082640926410264112641226413264142641526416264172641826419264202642126422264232642426425264262642726428264292643026431264322643326434264352643626437264382643926440264412644226443264442644526446264472644826449264502645126452264532645426455264562645726458264592646026461264622646326464264652646626467264682646926470264712647226473264742647526476264772647826479264802648126482264832648426485264862648726488264892649026491264922649326494264952649626497264982649926500265012650226503265042650526506265072650826509265102651126512265132651426515265162651726518265192652026521265222652326524265252652626527265282652926530265312653226533265342653526536265372653826539265402654126542265432654426545265462654726548265492655026551265522655326554265552655626557265582655926560265612656226563265642656526566265672656826569265702657126572265732657426575265762657726578265792658026581265822658326584265852658626587265882658926590265912659226593265942659526596265972659826599266002660126602266032660426605266062660726608266092661026611266122661326614266152661626617266182661926620266212662226623266242662526626266272662826629266302663126632266332663426635266362663726638266392664026641266422664326644266452664626647266482664926650266512665226653266542665526656266572665826659266602666126662266632666426665266662666726668266692667026671266722667326674266752667626677266782667926680266812668226683266842668526686266872668826689266902669126692266932669426695266962669726698266992670026701267022670326704267052670626707267082670926710267112671226713267142671526716267172671826719267202672126722267232672426725267262672726728267292673026731267322673326734267352673626737267382673926740267412674226743267442674526746267472674826749267502675126752267532675426755267562675726758267592676026761267622676326764267652676626767267682676926770267712677226773267742677526776267772677826779267802678126782267832678426785267862678726788267892679026791267922679326794267952679626797267982679926800268012680226803268042680526806268072680826809268102681126812268132681426815268162681726818268192682026821268222682326824268252682626827268282682926830268312683226833268342683526836268372683826839268402684126842268432684426845268462684726848268492685026851268522685326854268552685626857268582685926860268612686226863268642686526866268672686826869268702687126872268732687426875268762687726878268792688026881268822688326884268852688626887268882688926890268912689226893268942689526896268972689826899269002690126902269032690426905269062690726908269092691026911269122691326914269152691626917269182691926920269212692226923269242692526926269272692826929269302693126932269332693426935269362693726938269392694026941269422694326944269452694626947269482694926950269512695226953269542695526956269572695826959269602696126962269632696426965269662696726968269692697026971269722697326974269752697626977269782697926980269812698226983269842698526986269872698826989269902699126992269932699426995269962699726998269992700027001270022700327004270052700627007270082700927010270112701227013270142701527016270172701827019270202702127022270232702427025270262702727028270292703027031270322703327034270352703627037270382703927040270412704227043270442704527046270472704827049270502705127052270532705427055270562705727058270592706027061270622706327064270652706627067270682706927070270712707227073270742707527076270772707827079270802708127082270832708427085270862708727088270892709027091270922709327094270952709627097270982709927100271012710227103271042710527106271072710827109271102711127112271132711427115271162711727118271192712027121271222712327124271252712627127271282712927130271312713227133271342713527136271372713827139271402714127142271432714427145271462714727148271492715027151271522715327154271552715627157271582715927160271612716227163271642716527166271672716827169271702717127172271732717427175271762717727178271792718027181271822718327184271852718627187271882718927190271912719227193271942719527196271972719827199272002720127202272032720427205272062720727208272092721027211272122721327214272152721627217272182721927220272212722227223272242722527226272272722827229272302723127232272332723427235272362723727238272392724027241272422724327244272452724627247272482724927250272512725227253272542725527256272572725827259272602726127262272632726427265272662726727268272692727027271272722727327274272752727627277272782727927280272812728227283272842728527286272872728827289272902729127292272932729427295272962729727298272992730027301273022730327304273052730627307273082730927310273112731227313273142731527316273172731827319273202732127322273232732427325273262732727328273292733027331273322733327334273352733627337273382733927340273412734227343273442734527346273472734827349273502735127352273532735427355273562735727358273592736027361273622736327364273652736627367273682736927370273712737227373273742737527376273772737827379273802738127382273832738427385273862738727388273892739027391273922739327394273952739627397273982739927400274012740227403274042740527406274072740827409274102741127412274132741427415274162741727418274192742027421274222742327424274252742627427274282742927430274312743227433274342743527436274372743827439274402744127442274432744427445274462744727448274492745027451274522745327454274552745627457274582745927460274612746227463274642746527466274672746827469274702747127472274732747427475274762747727478274792748027481274822748327484274852748627487274882748927490274912749227493274942749527496274972749827499275002750127502275032750427505275062750727508275092751027511275122751327514275152751627517275182751927520275212752227523275242752527526275272752827529275302753127532275332753427535275362753727538275392754027541275422754327544275452754627547275482754927550275512755227553275542755527556275572755827559275602756127562275632756427565275662756727568275692757027571275722757327574275752757627577275782757927580275812758227583275842758527586275872758827589275902759127592275932759427595275962759727598275992760027601276022760327604276052760627607276082760927610276112761227613276142761527616276172761827619276202762127622276232762427625276262762727628276292763027631276322763327634276352763627637276382763927640276412764227643276442764527646276472764827649276502765127652276532765427655276562765727658276592766027661276622766327664276652766627667276682766927670276712767227673276742767527676276772767827679276802768127682276832768427685276862768727688276892769027691276922769327694276952769627697276982769927700277012770227703277042770527706277072770827709277102771127712277132771427715277162771727718277192772027721277222772327724277252772627727277282772927730277312773227733277342773527736277372773827739277402774127742277432774427745277462774727748277492775027751277522775327754277552775627757277582775927760277612776227763277642776527766277672776827769277702777127772277732777427775277762777727778277792778027781277822778327784277852778627787277882778927790277912779227793277942779527796277972779827799278002780127802278032780427805278062780727808278092781027811278122781327814278152781627817278182781927820278212782227823278242782527826278272782827829278302783127832278332783427835278362783727838278392784027841278422784327844278452784627847278482784927850278512785227853278542785527856278572785827859278602786127862278632786427865278662786727868278692787027871278722787327874278752787627877278782787927880278812788227883278842788527886278872788827889278902789127892278932789427895278962789727898278992790027901279022790327904279052790627907279082790927910279112791227913279142791527916279172791827919279202792127922279232792427925279262792727928279292793027931279322793327934279352793627937279382793927940279412794227943279442794527946279472794827949279502795127952279532795427955279562795727958279592796027961279622796327964279652796627967279682796927970279712797227973279742797527976279772797827979279802798127982279832798427985279862798727988279892799027991279922799327994279952799627997279982799928000280012800228003280042800528006280072800828009280102801128012280132801428015280162801728018280192802028021280222802328024280252802628027280282802928030280312803228033280342803528036280372803828039280402804128042280432804428045280462804728048280492805028051280522805328054280552805628057280582805928060280612806228063280642806528066280672806828069280702807128072280732807428075280762807728078280792808028081280822808328084280852808628087280882808928090280912809228093280942809528096280972809828099281002810128102281032810428105281062810728108281092811028111281122811328114281152811628117281182811928120281212812228123281242812528126281272812828129281302813128132281332813428135281362813728138281392814028141281422814328144281452814628147281482814928150281512815228153281542815528156281572815828159281602816128162281632816428165281662816728168281692817028171281722817328174281752817628177281782817928180281812818228183281842818528186281872818828189281902819128192281932819428195281962819728198281992820028201282022820328204282052820628207282082820928210282112821228213282142821528216282172821828219282202822128222282232822428225282262822728228282292823028231282322823328234282352823628237282382823928240282412824228243282442824528246282472824828249282502825128252282532825428255282562825728258282592826028261282622826328264282652826628267282682826928270282712827228273282742827528276282772827828279282802828128282282832828428285282862828728288282892829028291282922829328294282952829628297282982829928300283012830228303283042830528306283072830828309283102831128312283132831428315283162831728318283192832028321283222832328324283252832628327283282832928330283312833228333283342833528336283372833828339283402834128342283432834428345283462834728348283492835028351283522835328354283552835628357283582835928360283612836228363283642836528366283672836828369283702837128372283732837428375283762837728378283792838028381283822838328384283852838628387283882838928390283912839228393283942839528396283972839828399284002840128402284032840428405284062840728408284092841028411284122841328414284152841628417284182841928420284212842228423284242842528426284272842828429284302843128432284332843428435284362843728438284392844028441284422844328444284452844628447284482844928450284512845228453284542845528456284572845828459284602846128462284632846428465284662846728468284692847028471284722847328474284752847628477284782847928480284812848228483284842848528486284872848828489284902849128492284932849428495284962849728498284992850028501285022850328504285052850628507285082850928510285112851228513285142851528516285172851828519285202852128522285232852428525285262852728528285292853028531285322853328534285352853628537285382853928540285412854228543285442854528546285472854828549285502855128552285532855428555285562855728558285592856028561285622856328564285652856628567285682856928570285712857228573285742857528576285772857828579285802858128582285832858428585285862858728588285892859028591285922859328594285952859628597285982859928600286012860228603286042860528606286072860828609286102861128612286132861428615286162861728618286192862028621286222862328624286252862628627286282862928630286312863228633286342863528636286372863828639286402864128642286432864428645286462864728648286492865028651286522865328654286552865628657286582865928660286612866228663286642866528666286672866828669286702867128672286732867428675286762867728678286792868028681286822868328684286852868628687286882868928690286912869228693286942869528696286972869828699287002870128702287032870428705287062870728708287092871028711287122871328714287152871628717287182871928720287212872228723287242872528726287272872828729287302873128732287332873428735287362873728738287392874028741287422874328744287452874628747287482874928750287512875228753287542875528756287572875828759287602876128762287632876428765287662876728768287692877028771287722877328774287752877628777287782877928780287812878228783287842878528786287872878828789287902879128792287932879428795287962879728798287992880028801288022880328804288052880628807288082880928810288112881228813288142881528816288172881828819288202882128822288232882428825288262882728828288292883028831288322883328834288352883628837288382883928840288412884228843288442884528846288472884828849288502885128852288532885428855288562885728858288592886028861288622886328864288652886628867288682886928870288712887228873288742887528876288772887828879288802888128882288832888428885288862888728888288892889028891288922889328894288952889628897288982889928900289012890228903289042890528906289072890828909289102891128912289132891428915289162891728918289192892028921289222892328924289252892628927289282892928930289312893228933289342893528936289372893828939289402894128942289432894428945289462894728948289492895028951289522895328954289552895628957289582895928960289612896228963289642896528966289672896828969289702897128972289732897428975289762897728978289792898028981289822898328984289852898628987289882898928990289912899228993289942899528996289972899828999290002900129002290032900429005290062900729008290092901029011290122901329014290152901629017290182901929020290212902229023290242902529026290272902829029290302903129032290332903429035290362903729038290392904029041290422904329044290452904629047290482904929050290512905229053290542905529056290572905829059290602906129062290632906429065290662906729068290692907029071290722907329074290752907629077290782907929080290812908229083290842908529086290872908829089290902909129092290932909429095290962909729098290992910029101291022910329104291052910629107291082910929110291112911229113291142911529116291172911829119291202912129122291232912429125291262912729128291292913029131291322913329134291352913629137291382913929140291412914229143291442914529146291472914829149291502915129152291532915429155291562915729158291592916029161291622916329164291652916629167291682916929170291712917229173291742917529176291772917829179291802918129182291832918429185291862918729188291892919029191291922919329194291952919629197291982919929200292012920229203292042920529206292072920829209292102921129212292132921429215292162921729218292192922029221292222922329224292252922629227292282922929230292312923229233292342923529236292372923829239292402924129242292432924429245292462924729248292492925029251292522925329254292552925629257292582925929260292612926229263292642926529266292672926829269292702927129272292732927429275292762927729278292792928029281292822928329284292852928629287292882928929290292912929229293292942929529296292972929829299293002930129302293032930429305293062930729308293092931029311293122931329314293152931629317293182931929320293212932229323293242932529326293272932829329293302933129332293332933429335293362933729338293392934029341293422934329344293452934629347293482934929350293512935229353293542935529356293572935829359293602936129362293632936429365293662936729368293692937029371293722937329374293752937629377293782937929380293812938229383293842938529386293872938829389293902939129392293932939429395293962939729398293992940029401294022940329404294052940629407294082940929410294112941229413294142941529416294172941829419294202942129422294232942429425294262942729428294292943029431294322943329434294352943629437294382943929440294412944229443294442944529446294472944829449294502945129452294532945429455294562945729458294592946029461294622946329464294652946629467294682946929470294712947229473294742947529476294772947829479294802948129482294832948429485294862948729488294892949029491294922949329494294952949629497294982949929500295012950229503295042950529506295072950829509295102951129512295132951429515295162951729518295192952029521295222952329524295252952629527295282952929530295312953229533295342953529536295372953829539295402954129542295432954429545295462954729548295492955029551295522955329554295552955629557295582955929560295612956229563295642956529566295672956829569295702957129572295732957429575295762957729578295792958029581295822958329584295852958629587295882958929590295912959229593295942959529596295972959829599296002960129602296032960429605296062960729608296092961029611296122961329614296152961629617296182961929620296212962229623296242962529626296272962829629296302963129632296332963429635296362963729638296392964029641296422964329644296452964629647296482964929650296512965229653296542965529656296572965829659296602966129662296632966429665296662966729668296692967029671296722967329674296752967629677296782967929680296812968229683296842968529686296872968829689296902969129692296932969429695296962969729698296992970029701297022970329704297052970629707297082970929710297112971229713297142971529716297172971829719297202972129722297232972429725297262972729728297292973029731297322973329734297352973629737297382973929740297412974229743297442974529746297472974829749297502975129752297532975429755297562975729758297592976029761297622976329764297652976629767297682976929770297712977229773297742977529776297772977829779297802978129782297832978429785297862978729788297892979029791297922979329794297952979629797297982979929800298012980229803298042980529806298072980829809298102981129812298132981429815298162981729818298192982029821298222982329824298252982629827298282982929830298312983229833298342983529836298372983829839298402984129842298432984429845298462984729848298492985029851298522985329854298552985629857298582985929860298612986229863298642986529866298672986829869298702987129872298732987429875298762987729878298792988029881298822988329884298852988629887298882988929890298912989229893298942989529896298972989829899299002990129902299032990429905299062990729908299092991029911299122991329914299152991629917299182991929920299212992229923299242992529926299272992829929299302993129932299332993429935299362993729938299392994029941299422994329944299452994629947299482994929950299512995229953299542995529956299572995829959299602996129962299632996429965299662996729968299692997029971299722997329974299752997629977299782997929980299812998229983299842998529986299872998829989299902999129992299932999429995299962999729998299993000030001300023000330004300053000630007300083000930010300113001230013300143001530016300173001830019300203002130022300233002430025300263002730028300293003030031300323003330034300353003630037300383003930040300413004230043300443004530046300473004830049300503005130052300533005430055300563005730058300593006030061300623006330064300653006630067300683006930070300713007230073300743007530076300773007830079300803008130082300833008430085300863008730088300893009030091300923009330094300953009630097300983009930100301013010230103301043010530106301073010830109301103011130112301133011430115301163011730118301193012030121301223012330124301253012630127301283012930130301313013230133301343013530136301373013830139301403014130142301433014430145301463014730148301493015030151301523015330154301553015630157301583015930160301613016230163301643016530166301673016830169301703017130172301733017430175301763017730178301793018030181301823018330184301853018630187301883018930190301913019230193301943019530196301973019830199302003020130202302033020430205302063020730208302093021030211302123021330214302153021630217302183021930220302213022230223302243022530226302273022830229302303023130232302333023430235302363023730238302393024030241302423024330244302453024630247302483024930250302513025230253302543025530256302573025830259302603026130262302633026430265302663026730268302693027030271302723027330274302753027630277302783027930280302813028230283302843028530286302873028830289302903029130292302933029430295302963029730298302993030030301303023030330304303053030630307303083030930310303113031230313303143031530316303173031830319303203032130322303233032430325303263032730328303293033030331303323033330334303353033630337303383033930340303413034230343303443034530346303473034830349303503035130352303533035430355303563035730358303593036030361303623036330364303653036630367303683036930370303713037230373303743037530376303773037830379303803038130382303833038430385303863038730388303893039030391303923039330394303953039630397303983039930400304013040230403304043040530406304073040830409304103041130412304133041430415304163041730418304193042030421304223042330424304253042630427304283042930430304313043230433304343043530436304373043830439304403044130442304433044430445304463044730448304493045030451304523045330454304553045630457304583045930460304613046230463304643046530466304673046830469304703047130472304733047430475304763047730478304793048030481304823048330484304853048630487304883048930490304913049230493304943049530496304973049830499305003050130502305033050430505305063050730508305093051030511305123051330514305153051630517305183051930520305213052230523305243052530526305273052830529305303053130532305333053430535305363053730538305393054030541305423054330544305453054630547305483054930550305513055230553305543055530556305573055830559305603056130562305633056430565305663056730568305693057030571305723057330574305753057630577305783057930580305813058230583305843058530586305873058830589305903059130592305933059430595305963059730598305993060030601306023060330604306053060630607306083060930610306113061230613306143061530616306173061830619306203062130622306233062430625306263062730628306293063030631306323063330634306353063630637306383063930640306413064230643306443064530646306473064830649306503065130652306533065430655306563065730658306593066030661306623066330664306653066630667306683066930670306713067230673306743067530676306773067830679306803068130682306833068430685306863068730688306893069030691306923069330694306953069630697306983069930700307013070230703307043070530706307073070830709307103071130712307133071430715307163071730718307193072030721307223072330724307253072630727307283072930730307313073230733307343073530736307373073830739307403074130742307433074430745307463074730748307493075030751307523075330754307553075630757307583075930760307613076230763307643076530766307673076830769307703077130772307733077430775307763077730778307793078030781307823078330784307853078630787307883078930790307913079230793307943079530796307973079830799308003080130802308033080430805308063080730808308093081030811308123081330814308153081630817308183081930820308213082230823308243082530826308273082830829308303083130832308333083430835308363083730838308393084030841308423084330844308453084630847308483084930850308513085230853308543085530856308573085830859308603086130862308633086430865308663086730868308693087030871308723087330874308753087630877308783087930880308813088230883308843088530886308873088830889308903089130892308933089430895308963089730898308993090030901309023090330904309053090630907309083090930910309113091230913309143091530916309173091830919309203092130922309233092430925309263092730928309293093030931309323093330934309353093630937309383093930940309413094230943309443094530946309473094830949309503095130952309533095430955309563095730958309593096030961309623096330964309653096630967309683096930970309713097230973309743097530976309773097830979309803098130982309833098430985309863098730988309893099030991309923099330994309953099630997309983099931000310013100231003310043100531006310073100831009310103101131012310133101431015310163101731018310193102031021310223102331024310253102631027310283102931030310313103231033310343103531036310373103831039310403104131042310433104431045310463104731048310493105031051310523105331054310553105631057310583105931060310613106231063310643106531066310673106831069310703107131072310733107431075310763107731078310793108031081310823108331084310853108631087310883108931090310913109231093310943109531096310973109831099311003110131102311033110431105311063110731108311093111031111311123111331114311153111631117311183111931120311213112231123311243112531126311273112831129311303113131132311333113431135311363113731138311393114031141311423114331144311453114631147311483114931150311513115231153311543115531156311573115831159311603116131162311633116431165311663116731168311693117031171311723117331174311753117631177311783117931180311813118231183311843118531186311873118831189311903119131192311933119431195311963119731198311993120031201312023120331204312053120631207312083120931210312113121231213312143121531216312173121831219312203122131222312233122431225312263122731228312293123031231312323123331234312353123631237312383123931240312413124231243312443124531246312473124831249312503125131252312533125431255312563125731258312593126031261312623126331264312653126631267312683126931270312713127231273312743127531276312773127831279312803128131282312833128431285312863128731288312893129031291312923129331294312953129631297312983129931300313013130231303313043130531306313073130831309313103131131312313133131431315313163131731318313193132031321313223132331324313253132631327313283132931330313313133231333313343133531336313373133831339313403134131342313433134431345313463134731348313493135031351313523135331354313553135631357313583135931360313613136231363313643136531366313673136831369313703137131372313733137431375313763137731378313793138031381313823138331384313853138631387313883138931390313913139231393313943139531396313973139831399314003140131402314033140431405314063140731408314093141031411314123141331414314153141631417314183141931420314213142231423314243142531426314273142831429314303143131432314333143431435314363143731438314393144031441314423144331444314453144631447314483144931450314513145231453314543145531456314573145831459314603146131462314633146431465314663146731468314693147031471314723147331474314753147631477314783147931480314813148231483314843148531486314873148831489314903149131492314933149431495314963149731498314993150031501315023150331504315053150631507315083150931510315113151231513315143151531516315173151831519315203152131522315233152431525315263152731528315293153031531315323153331534315353153631537315383153931540315413154231543315443154531546315473154831549315503155131552315533155431555315563155731558315593156031561315623156331564315653156631567315683156931570315713157231573315743157531576315773157831579315803158131582315833158431585315863158731588315893159031591315923159331594315953159631597315983159931600316013160231603316043160531606316073160831609316103161131612316133161431615316163161731618316193162031621316223162331624316253162631627316283162931630316313163231633316343163531636316373163831639316403164131642316433164431645316463164731648316493165031651316523165331654316553165631657316583165931660316613166231663316643166531666316673166831669316703167131672316733167431675316763167731678316793168031681316823168331684316853168631687316883168931690316913169231693316943169531696316973169831699317003170131702317033170431705317063170731708317093171031711317123171331714317153171631717317183171931720317213172231723317243172531726317273172831729317303173131732317333173431735317363173731738317393174031741317423174331744317453174631747317483174931750317513175231753317543175531756317573175831759317603176131762317633176431765317663176731768317693177031771317723177331774317753177631777317783177931780317813178231783317843178531786317873178831789317903179131792317933179431795317963179731798317993180031801318023180331804318053180631807318083180931810318113181231813318143181531816318173181831819318203182131822318233182431825318263182731828318293183031831318323183331834318353183631837318383183931840318413184231843318443184531846318473184831849318503185131852318533185431855318563185731858318593186031861318623186331864318653186631867318683186931870318713187231873318743187531876318773187831879318803188131882318833188431885318863188731888318893189031891318923189331894318953189631897318983189931900319013190231903319043190531906319073190831909319103191131912319133191431915319163191731918319193192031921319223192331924319253192631927319283192931930319313193231933319343193531936319373193831939319403194131942319433194431945319463194731948319493195031951319523195331954319553195631957319583195931960319613196231963319643196531966319673196831969319703197131972319733197431975319763197731978319793198031981319823198331984319853198631987319883198931990319913199231993319943199531996319973199831999320003200132002320033200432005320063200732008320093201032011320123201332014320153201632017320183201932020320213202232023320243202532026320273202832029320303203132032320333203432035320363203732038320393204032041320423204332044320453204632047320483204932050320513205232053320543205532056320573205832059320603206132062320633206432065320663206732068320693207032071320723207332074320753207632077320783207932080320813208232083320843208532086320873208832089320903209132092320933209432095320963209732098320993210032101321023210332104321053210632107321083210932110321113211232113321143211532116321173211832119321203212132122321233212432125321263212732128321293213032131321323213332134321353213632137321383213932140321413214232143321443214532146321473214832149321503215132152321533215432155321563215732158321593216032161321623216332164321653216632167321683216932170321713217232173321743217532176321773217832179321803218132182321833218432185321863218732188321893219032191321923219332194321953219632197321983219932200322013220232203322043220532206322073220832209322103221132212322133221432215322163221732218322193222032221322223222332224322253222632227322283222932230322313223232233322343223532236322373223832239322403224132242322433224432245322463224732248322493225032251322523225332254322553225632257322583225932260322613226232263322643226532266322673226832269322703227132272322733227432275322763227732278322793228032281322823228332284322853228632287322883228932290322913229232293322943229532296322973229832299323003230132302323033230432305323063230732308323093231032311323123231332314323153231632317323183231932320323213232232323323243232532326323273232832329323303233132332323333233432335323363233732338323393234032341323423234332344323453234632347323483234932350323513235232353323543235532356323573235832359323603236132362323633236432365323663236732368323693237032371323723237332374323753237632377323783237932380323813238232383323843238532386323873238832389323903239132392323933239432395323963239732398323993240032401324023240332404324053240632407324083240932410324113241232413324143241532416324173241832419324203242132422324233242432425324263242732428324293243032431324323243332434324353243632437324383243932440324413244232443324443244532446324473244832449324503245132452324533245432455324563245732458324593246032461324623246332464324653246632467324683246932470324713247232473324743247532476324773247832479324803248132482324833248432485324863248732488324893249032491324923249332494324953249632497324983249932500325013250232503325043250532506325073250832509325103251132512325133251432515325163251732518325193252032521325223252332524325253252632527325283252932530325313253232533325343253532536325373253832539325403254132542325433254432545325463254732548325493255032551325523255332554325553255632557325583255932560325613256232563325643256532566325673256832569325703257132572325733257432575325763257732578325793258032581325823258332584325853258632587325883258932590325913259232593325943259532596325973259832599326003260132602326033260432605326063260732608326093261032611326123261332614326153261632617326183261932620326213262232623326243262532626326273262832629326303263132632326333263432635326363263732638326393264032641326423264332644326453264632647326483264932650326513265232653326543265532656326573265832659326603266132662326633266432665326663266732668326693267032671326723267332674326753267632677326783267932680326813268232683326843268532686326873268832689326903269132692326933269432695326963269732698326993270032701327023270332704327053270632707327083270932710327113271232713327143271532716327173271832719327203272132722327233272432725327263272732728327293273032731327323273332734327353273632737327383273932740327413274232743327443274532746327473274832749327503275132752327533275432755327563275732758327593276032761327623276332764327653276632767327683276932770327713277232773327743277532776327773277832779327803278132782327833278432785327863278732788327893279032791327923279332794327953279632797327983279932800328013280232803328043280532806328073280832809328103281132812328133281432815328163281732818328193282032821328223282332824328253282632827328283282932830328313283232833328343283532836328373283832839328403284132842328433284432845328463284732848328493285032851328523285332854328553285632857328583285932860328613286232863328643286532866328673286832869328703287132872328733287432875328763287732878328793288032881328823288332884328853288632887328883288932890328913289232893328943289532896328973289832899329003290132902329033290432905329063290732908329093291032911329123291332914329153291632917329183291932920329213292232923329243292532926329273292832929329303293132932329333293432935329363293732938329393294032941329423294332944329453294632947329483294932950329513295232953329543295532956329573295832959329603296132962329633296432965329663296732968329693297032971329723297332974329753297632977329783297932980329813298232983329843298532986329873298832989329903299132992329933299432995329963299732998329993300033001330023300333004330053300633007330083300933010330113301233013330143301533016330173301833019330203302133022330233302433025330263302733028330293303033031330323303333034330353303633037330383303933040330413304233043330443304533046330473304833049330503305133052330533305433055330563305733058330593306033061330623306333064330653306633067330683306933070330713307233073330743307533076330773307833079330803308133082330833308433085330863308733088330893309033091330923309333094330953309633097330983309933100331013310233103331043310533106331073310833109331103311133112331133311433115331163311733118331193312033121331223312333124331253312633127331283312933130331313313233133331343313533136331373313833139331403314133142331433314433145331463314733148331493315033151331523315333154331553315633157331583315933160331613316233163331643316533166331673316833169331703317133172331733317433175331763317733178331793318033181331823318333184331853318633187331883318933190331913319233193331943319533196331973319833199332003320133202332033320433205332063320733208332093321033211332123321333214332153321633217332183321933220332213322233223332243322533226332273322833229332303323133232332333323433235332363323733238332393324033241332423324333244332453324633247332483324933250332513325233253332543325533256332573325833259332603326133262332633326433265332663326733268332693327033271332723327333274332753327633277332783327933280332813328233283332843328533286332873328833289332903329133292332933329433295332963329733298332993330033301333023330333304333053330633307333083330933310333113331233313333143331533316333173331833319333203332133322333233332433325333263332733328333293333033331333323333333334333353333633337333383333933340333413334233343333443334533346333473334833349333503335133352333533335433355333563335733358333593336033361333623336333364333653336633367333683336933370333713337233373333743337533376333773337833379333803338133382333833338433385333863338733388333893339033391333923339333394333953339633397333983339933400334013340233403334043340533406334073340833409334103341133412334133341433415334163341733418334193342033421334223342333424334253342633427334283342933430334313343233433334343343533436334373343833439334403344133442334433344433445334463344733448334493345033451334523345333454334553345633457334583345933460334613346233463334643346533466334673346833469334703347133472334733347433475334763347733478334793348033481334823348333484334853348633487334883348933490334913349233493334943349533496334973349833499335003350133502335033350433505335063350733508335093351033511335123351333514335153351633517335183351933520335213352233523335243352533526335273352833529335303353133532335333353433535335363353733538335393354033541335423354333544335453354633547335483354933550335513355233553335543355533556335573355833559335603356133562335633356433565335663356733568335693357033571335723357333574335753357633577335783357933580335813358233583335843358533586335873358833589335903359133592335933359433595335963359733598335993360033601336023360333604336053360633607336083360933610336113361233613336143361533616336173361833619336203362133622336233362433625336263362733628336293363033631336323363333634336353363633637336383363933640336413364233643336443364533646336473364833649336503365133652336533365433655336563365733658336593366033661336623366333664336653366633667336683366933670336713367233673336743367533676336773367833679336803368133682336833368433685336863368733688336893369033691336923369333694336953369633697336983369933700337013370233703337043370533706337073370833709337103371133712337133371433715337163371733718337193372033721337223372333724337253372633727337283372933730337313373233733337343373533736337373373833739337403374133742337433374433745337463374733748337493375033751337523375333754337553375633757337583375933760337613376233763337643376533766337673376833769337703377133772337733377433775337763377733778337793378033781337823378333784337853378633787337883378933790337913379233793337943379533796337973379833799338003380133802338033380433805338063380733808338093381033811338123381333814338153381633817338183381933820338213382233823338243382533826338273382833829338303383133832338333383433835338363383733838338393384033841338423384333844338453384633847338483384933850338513385233853338543385533856338573385833859338603386133862338633386433865338663386733868338693387033871338723387333874338753387633877338783387933880338813388233883338843388533886338873388833889338903389133892338933389433895338963389733898338993390033901339023390333904339053390633907339083390933910339113391233913339143391533916339173391833919339203392133922339233392433925339263392733928339293393033931339323393333934339353393633937339383393933940339413394233943339443394533946339473394833949339503395133952339533395433955339563395733958339593396033961339623396333964339653396633967339683396933970339713397233973339743397533976339773397833979339803398133982339833398433985339863398733988339893399033991339923399333994339953399633997339983399934000340013400234003340043400534006340073400834009340103401134012340133401434015340163401734018340193402034021340223402334024340253402634027340283402934030340313403234033340343403534036340373403834039340403404134042340433404434045340463404734048340493405034051340523405334054340553405634057340583405934060340613406234063340643406534066340673406834069340703407134072340733407434075340763407734078340793408034081340823408334084340853408634087340883408934090340913409234093340943409534096340973409834099341003410134102341033410434105341063410734108341093411034111341123411334114341153411634117341183411934120341213412234123341243412534126341273412834129341303413134132341333413434135341363413734138341393414034141341423414334144341453414634147341483414934150341513415234153341543415534156341573415834159341603416134162341633416434165341663416734168341693417034171341723417334174341753417634177341783417934180341813418234183341843418534186341873418834189341903419134192341933419434195341963419734198341993420034201342023420334204342053420634207342083420934210342113421234213342143421534216342173421834219342203422134222342233422434225342263422734228342293423034231342323423334234342353423634237342383423934240342413424234243342443424534246342473424834249342503425134252342533425434255342563425734258342593426034261342623426334264342653426634267342683426934270342713427234273342743427534276342773427834279342803428134282342833428434285342863428734288342893429034291342923429334294342953429634297342983429934300343013430234303343043430534306343073430834309343103431134312343133431434315343163431734318343193432034321343223432334324343253432634327343283432934330343313433234333343343433534336343373433834339343403434134342343433434434345343463434734348343493435034351343523435334354343553435634357343583435934360343613436234363343643436534366343673436834369343703437134372343733437434375343763437734378343793438034381343823438334384343853438634387343883438934390343913439234393343943439534396343973439834399344003440134402344033440434405344063440734408344093441034411344123441334414344153441634417344183441934420344213442234423344243442534426344273442834429344303443134432344333443434435344363443734438344393444034441344423444334444344453444634447344483444934450344513445234453344543445534456344573445834459344603446134462344633446434465344663446734468344693447034471344723447334474344753447634477344783447934480344813448234483344843448534486344873448834489344903449134492344933449434495344963449734498344993450034501345023450334504345053450634507345083450934510345113451234513345143451534516345173451834519345203452134522345233452434525345263452734528345293453034531345323453334534345353453634537345383453934540345413454234543345443454534546345473454834549345503455134552345533455434555345563455734558345593456034561345623456334564345653456634567345683456934570345713457234573345743457534576345773457834579345803458134582345833458434585345863458734588345893459034591345923459334594345953459634597345983459934600346013460234603346043460534606346073460834609346103461134612346133461434615346163461734618346193462034621346223462334624346253462634627346283462934630346313463234633346343463534636346373463834639346403464134642346433464434645346463464734648346493465034651346523465334654346553465634657346583465934660346613466234663346643466534666346673466834669346703467134672346733467434675346763467734678346793468034681346823468334684346853468634687346883468934690346913469234693346943469534696346973469834699347003470134702347033470434705347063470734708347093471034711347123471334714347153471634717347183471934720347213472234723347243472534726347273472834729347303473134732347333473434735347363473734738347393474034741347423474334744347453474634747347483474934750347513475234753347543475534756347573475834759347603476134762347633476434765347663476734768347693477034771347723477334774347753477634777347783477934780347813478234783347843478534786347873478834789347903479134792347933479434795347963479734798347993480034801348023480334804348053480634807348083480934810348113481234813348143481534816348173481834819348203482134822348233482434825348263482734828348293483034831348323483334834348353483634837348383483934840348413484234843348443484534846348473484834849348503485134852348533485434855348563485734858348593486034861348623486334864348653486634867348683486934870348713487234873348743487534876348773487834879348803488134882348833488434885348863488734888348893489034891348923489334894348953489634897348983489934900349013490234903349043490534906349073490834909349103491134912349133491434915349163491734918349193492034921349223492334924349253492634927349283492934930349313493234933349343493534936349373493834939349403494134942349433494434945349463494734948349493495034951349523495334954349553495634957349583495934960349613496234963349643496534966349673496834969349703497134972349733497434975349763497734978349793498034981349823498334984349853498634987349883498934990349913499234993349943499534996349973499834999350003500135002350033500435005350063500735008350093501035011350123501335014350153501635017350183501935020350213502235023350243502535026350273502835029350303503135032350333503435035350363503735038350393504035041350423504335044350453504635047350483504935050350513505235053350543505535056350573505835059350603506135062350633506435065350663506735068350693507035071350723507335074350753507635077350783507935080350813508235083350843508535086350873508835089350903509135092350933509435095350963509735098350993510035101351023510335104351053510635107351083510935110351113511235113351143511535116351173511835119351203512135122351233512435125351263512735128351293513035131351323513335134351353513635137351383513935140351413514235143351443514535146351473514835149351503515135152351533515435155351563515735158351593516035161351623516335164351653516635167351683516935170351713517235173351743517535176351773517835179351803518135182351833518435185351863518735188351893519035191351923519335194351953519635197351983519935200352013520235203352043520535206352073520835209352103521135212352133521435215352163521735218352193522035221352223522335224352253522635227352283522935230352313523235233352343523535236352373523835239352403524135242352433524435245352463524735248352493525035251352523525335254352553525635257352583525935260352613526235263352643526535266352673526835269352703527135272352733527435275352763527735278352793528035281352823528335284352853528635287352883528935290352913529235293352943529535296352973529835299353003530135302353033530435305353063530735308353093531035311353123531335314353153531635317353183531935320353213532235323353243532535326353273532835329353303533135332353333533435335353363533735338353393534035341353423534335344353453534635347353483534935350353513535235353353543535535356353573535835359353603536135362353633536435365353663536735368353693537035371353723537335374353753537635377353783537935380353813538235383353843538535386353873538835389353903539135392353933539435395353963539735398353993540035401354023540335404354053540635407354083540935410354113541235413354143541535416354173541835419354203542135422354233542435425354263542735428354293543035431354323543335434354353543635437354383543935440354413544235443354443544535446354473544835449354503545135452354533545435455354563545735458354593546035461354623546335464354653546635467354683546935470354713547235473354743547535476354773547835479354803548135482354833548435485354863548735488354893549035491354923549335494354953549635497354983549935500355013550235503355043550535506355073550835509355103551135512355133551435515355163551735518355193552035521355223552335524355253552635527355283552935530355313553235533355343553535536355373553835539355403554135542355433554435545355463554735548355493555035551355523555335554355553555635557355583555935560355613556235563355643556535566355673556835569355703557135572355733557435575355763557735578355793558035581355823558335584355853558635587355883558935590355913559235593355943559535596355973559835599356003560135602356033560435605356063560735608356093561035611356123561335614356153561635617356183561935620356213562235623356243562535626356273562835629356303563135632356333563435635356363563735638356393564035641356423564335644356453564635647356483564935650356513565235653356543565535656356573565835659356603566135662356633566435665356663566735668356693567035671356723567335674356753567635677356783567935680356813568235683356843568535686356873568835689356903569135692356933569435695356963569735698356993570035701357023570335704357053570635707357083570935710357113571235713357143571535716357173571835719357203572135722357233572435725357263572735728357293573035731357323573335734357353573635737357383573935740357413574235743357443574535746357473574835749357503575135752357533575435755357563575735758357593576035761357623576335764357653576635767357683576935770357713577235773357743577535776357773577835779357803578135782357833578435785357863578735788357893579035791357923579335794357953579635797357983579935800358013580235803358043580535806358073580835809358103581135812358133581435815358163581735818358193582035821358223582335824358253582635827358283582935830358313583235833358343583535836358373583835839358403584135842358433584435845358463584735848358493585035851358523585335854358553585635857358583585935860358613586235863358643586535866358673586835869358703587135872358733587435875358763587735878358793588035881358823588335884358853588635887358883588935890358913589235893358943589535896358973589835899359003590135902359033590435905359063590735908359093591035911359123591335914359153591635917359183591935920359213592235923359243592535926359273592835929359303593135932359333593435935359363593735938359393594035941359423594335944359453594635947359483594935950359513595235953359543595535956359573595835959359603596135962359633596435965359663596735968359693597035971359723597335974359753597635977359783597935980359813598235983359843598535986359873598835989359903599135992359933599435995359963599735998359993600036001360023600336004360053600636007360083600936010360113601236013360143601536016360173601836019360203602136022360233602436025360263602736028360293603036031360323603336034360353603636037360383603936040360413604236043360443604536046360473604836049360503605136052360533605436055360563605736058360593606036061360623606336064360653606636067360683606936070360713607236073360743607536076360773607836079360803608136082360833608436085360863608736088360893609036091360923609336094360953609636097360983609936100361013610236103361043610536106361073610836109361103611136112361133611436115361163611736118361193612036121361223612336124361253612636127361283612936130361313613236133361343613536136361373613836139361403614136142361433614436145361463614736148361493615036151361523615336154361553615636157361583615936160361613616236163361643616536166361673616836169361703617136172361733617436175361763617736178361793618036181361823618336184361853618636187361883618936190361913619236193361943619536196361973619836199362003620136202362033620436205362063620736208362093621036211362123621336214362153621636217362183621936220362213622236223362243622536226362273622836229362303623136232362333623436235362363623736238362393624036241362423624336244362453624636247362483624936250362513625236253362543625536256362573625836259362603626136262362633626436265362663626736268362693627036271362723627336274362753627636277362783627936280362813628236283362843628536286362873628836289362903629136292362933629436295362963629736298362993630036301363023630336304363053630636307363083630936310363113631236313363143631536316363173631836319363203632136322363233632436325363263632736328363293633036331363323633336334363353633636337363383633936340363413634236343363443634536346363473634836349363503635136352363533635436355363563635736358363593636036361363623636336364363653636636367363683636936370363713637236373363743637536376363773637836379363803638136382363833638436385363863638736388363893639036391363923639336394363953639636397363983639936400364013640236403364043640536406364073640836409364103641136412364133641436415364163641736418364193642036421364223642336424364253642636427364283642936430364313643236433364343643536436364373643836439364403644136442364433644436445364463644736448364493645036451364523645336454364553645636457364583645936460364613646236463364643646536466364673646836469364703647136472364733647436475364763647736478364793648036481364823648336484364853648636487364883648936490364913649236493364943649536496364973649836499365003650136502365033650436505365063650736508365093651036511365123651336514365153651636517365183651936520365213652236523365243652536526365273652836529365303653136532365333653436535365363653736538365393654036541365423654336544365453654636547365483654936550365513655236553365543655536556365573655836559365603656136562365633656436565365663656736568365693657036571365723657336574365753657636577365783657936580365813658236583365843658536586365873658836589365903659136592365933659436595365963659736598365993660036601366023660336604366053660636607366083660936610366113661236613366143661536616366173661836619366203662136622366233662436625366263662736628366293663036631366323663336634366353663636637366383663936640366413664236643366443664536646366473664836649366503665136652366533665436655366563665736658366593666036661366623666336664366653666636667366683666936670366713667236673366743667536676366773667836679366803668136682366833668436685366863668736688366893669036691366923669336694366953669636697366983669936700367013670236703367043670536706367073670836709367103671136712367133671436715367163671736718367193672036721367223672336724367253672636727367283672936730367313673236733367343673536736367373673836739367403674136742367433674436745367463674736748367493675036751367523675336754367553675636757367583675936760367613676236763367643676536766367673676836769367703677136772367733677436775367763677736778367793678036781367823678336784367853678636787367883678936790367913679236793367943679536796367973679836799368003680136802368033680436805368063680736808368093681036811368123681336814368153681636817368183681936820368213682236823368243682536826368273682836829368303683136832368333683436835368363683736838368393684036841368423684336844368453684636847368483684936850368513685236853368543685536856368573685836859368603686136862368633686436865368663686736868368693687036871368723687336874368753687636877368783687936880368813688236883368843688536886368873688836889368903689136892368933689436895368963689736898368993690036901369023690336904369053690636907369083690936910369113691236913369143691536916369173691836919369203692136922369233692436925369263692736928369293693036931369323693336934369353693636937369383693936940369413694236943369443694536946369473694836949369503695136952369533695436955369563695736958369593696036961369623696336964369653696636967369683696936970369713697236973369743697536976369773697836979369803698136982369833698436985369863698736988369893699036991369923699336994369953699636997369983699937000370013700237003370043700537006370073700837009370103701137012370133701437015370163701737018370193702037021370223702337024370253702637027370283702937030370313703237033370343703537036370373703837039370403704137042370433704437045370463704737048370493705037051370523705337054370553705637057370583705937060370613706237063370643706537066370673706837069370703707137072370733707437075370763707737078370793708037081370823708337084370853708637087370883708937090370913709237093370943709537096370973709837099371003710137102371033710437105371063710737108371093711037111371123711337114371153711637117371183711937120371213712237123371243712537126371273712837129371303713137132371333713437135371363713737138371393714037141371423714337144371453714637147371483714937150371513715237153371543715537156371573715837159371603716137162371633716437165371663716737168371693717037171371723717337174371753717637177371783717937180371813718237183371843718537186371873718837189371903719137192371933719437195371963719737198371993720037201372023720337204372053720637207372083720937210372113721237213372143721537216372173721837219372203722137222372233722437225372263722737228372293723037231372323723337234372353723637237372383723937240372413724237243372443724537246372473724837249372503725137252372533725437255372563725737258372593726037261372623726337264372653726637267372683726937270372713727237273372743727537276372773727837279372803728137282372833728437285372863728737288372893729037291372923729337294372953729637297372983729937300373013730237303373043730537306373073730837309373103731137312373133731437315373163731737318373193732037321373223732337324373253732637327373283732937330373313733237333373343733537336373373733837339373403734137342373433734437345373463734737348373493735037351373523735337354373553735637357373583735937360373613736237363373643736537366373673736837369373703737137372373733737437375373763737737378373793738037381373823738337384373853738637387373883738937390373913739237393373943739537396373973739837399374003740137402374033740437405374063740737408374093741037411374123741337414374153741637417374183741937420374213742237423374243742537426374273742837429374303743137432374333743437435374363743737438374393744037441374423744337444374453744637447374483744937450374513745237453374543745537456374573745837459374603746137462374633746437465374663746737468374693747037471374723747337474374753747637477374783747937480374813748237483374843748537486374873748837489374903749137492374933749437495374963749737498374993750037501375023750337504375053750637507375083750937510375113751237513375143751537516375173751837519375203752137522375233752437525375263752737528375293753037531375323753337534375353753637537375383753937540375413754237543375443754537546375473754837549375503755137552375533755437555375563755737558375593756037561375623756337564375653756637567375683756937570375713757237573375743757537576375773757837579375803758137582375833758437585375863758737588375893759037591375923759337594375953759637597375983759937600376013760237603376043760537606376073760837609376103761137612376133761437615376163761737618376193762037621376223762337624376253762637627376283762937630376313763237633376343763537636376373763837639376403764137642376433764437645376463764737648376493765037651376523765337654376553765637657376583765937660376613766237663376643766537666376673766837669376703767137672376733767437675376763767737678376793768037681376823768337684376853768637687376883768937690376913769237693376943769537696376973769837699377003770137702377033770437705377063770737708377093771037711377123771337714377153771637717377183771937720377213772237723377243772537726377273772837729377303773137732377333773437735377363773737738377393774037741377423774337744377453774637747377483774937750377513775237753377543775537756377573775837759377603776137762377633776437765377663776737768377693777037771377723777337774377753777637777377783777937780377813778237783377843778537786377873778837789377903779137792377933779437795377963779737798377993780037801378023780337804378053780637807378083780937810378113781237813378143781537816378173781837819378203782137822378233782437825378263782737828378293783037831378323783337834378353783637837378383783937840378413784237843378443784537846378473784837849378503785137852378533785437855378563785737858378593786037861378623786337864378653786637867378683786937870378713787237873378743787537876378773787837879378803788137882378833788437885378863788737888378893789037891378923789337894378953789637897378983789937900379013790237903379043790537906379073790837909379103791137912379133791437915379163791737918379193792037921379223792337924379253792637927379283792937930379313793237933379343793537936379373793837939379403794137942379433794437945379463794737948379493795037951379523795337954379553795637957379583795937960379613796237963379643796537966379673796837969379703797137972379733797437975379763797737978379793798037981379823798337984379853798637987379883798937990379913799237993379943799537996379973799837999380003800138002380033800438005380063800738008380093801038011380123801338014380153801638017380183801938020380213802238023380243802538026380273802838029380303803138032380333803438035380363803738038380393804038041380423804338044380453804638047380483804938050380513805238053380543805538056380573805838059380603806138062380633806438065380663806738068380693807038071380723807338074380753807638077380783807938080380813808238083380843808538086380873808838089380903809138092380933809438095380963809738098380993810038101381023810338104381053810638107381083810938110381113811238113381143811538116381173811838119381203812138122381233812438125381263812738128381293813038131381323813338134381353813638137381383813938140381413814238143381443814538146381473814838149381503815138152381533815438155381563815738158381593816038161381623816338164381653816638167381683816938170381713817238173381743817538176381773817838179381803818138182381833818438185381863818738188381893819038191381923819338194381953819638197381983819938200382013820238203382043820538206382073820838209382103821138212382133821438215382163821738218382193822038221382223822338224382253822638227382283822938230382313823238233382343823538236382373823838239382403824138242382433824438245382463824738248382493825038251382523825338254382553825638257382583825938260382613826238263382643826538266382673826838269382703827138272382733827438275382763827738278382793828038281382823828338284382853828638287382883828938290382913829238293382943829538296382973829838299383003830138302383033830438305383063830738308383093831038311383123831338314383153831638317383183831938320383213832238323383243832538326383273832838329383303833138332383333833438335383363833738338383393834038341383423834338344383453834638347383483834938350383513835238353383543835538356383573835838359383603836138362383633836438365383663836738368383693837038371383723837338374383753837638377383783837938380383813838238383383843838538386383873838838389383903839138392383933839438395383963839738398383993840038401384023840338404384053840638407384083840938410384113841238413384143841538416384173841838419384203842138422384233842438425384263842738428384293843038431384323843338434384353843638437384383843938440384413844238443384443844538446384473844838449384503845138452384533845438455384563845738458384593846038461384623846338464384653846638467384683846938470384713847238473384743847538476384773847838479384803848138482384833848438485384863848738488384893849038491384923849338494384953849638497384983849938500385013850238503385043850538506385073850838509385103851138512385133851438515385163851738518385193852038521385223852338524385253852638527385283852938530385313853238533385343853538536385373853838539385403854138542385433854438545385463854738548385493855038551385523855338554385553855638557385583855938560385613856238563385643856538566385673856838569385703857138572385733857438575385763857738578385793858038581385823858338584385853858638587385883858938590385913859238593385943859538596385973859838599386003860138602386033860438605386063860738608386093861038611386123861338614386153861638617386183861938620386213862238623386243862538626386273862838629386303863138632386333863438635386363863738638386393864038641386423864338644386453864638647386483864938650386513865238653386543865538656386573865838659386603866138662386633866438665386663866738668386693867038671386723867338674386753867638677386783867938680386813868238683386843868538686386873868838689386903869138692386933869438695386963869738698386993870038701387023870338704387053870638707387083870938710387113871238713387143871538716387173871838719387203872138722387233872438725387263872738728387293873038731387323873338734387353873638737387383873938740387413874238743387443874538746387473874838749387503875138752387533875438755387563875738758387593876038761387623876338764387653876638767387683876938770387713877238773387743877538776387773877838779387803878138782387833878438785387863878738788387893879038791387923879338794387953879638797387983879938800388013880238803388043880538806388073880838809388103881138812388133881438815388163881738818388193882038821388223882338824388253882638827388283882938830388313883238833388343883538836388373883838839388403884138842388433884438845388463884738848388493885038851388523885338854388553885638857388583885938860388613886238863388643886538866388673886838869388703887138872388733887438875388763887738878388793888038881388823888338884388853888638887388883888938890388913889238893388943889538896388973889838899389003890138902389033890438905389063890738908389093891038911389123891338914389153891638917389183891938920389213892238923389243892538926389273892838929389303893138932389333893438935389363893738938389393894038941389423894338944389453894638947389483894938950389513895238953389543895538956389573895838959389603896138962389633896438965389663896738968389693897038971389723897338974389753897638977389783897938980389813898238983389843898538986389873898838989389903899138992389933899438995389963899738998389993900039001390023900339004390053900639007390083900939010390113901239013390143901539016390173901839019390203902139022390233902439025390263902739028390293903039031390323903339034390353903639037390383903939040390413904239043390443904539046390473904839049390503905139052390533905439055390563905739058390593906039061390623906339064390653906639067390683906939070390713907239073390743907539076390773907839079390803908139082390833908439085390863908739088390893909039091390923909339094390953909639097390983909939100391013910239103391043910539106391073910839109391103911139112391133911439115391163911739118391193912039121391223912339124391253912639127391283912939130391313913239133391343913539136391373913839139391403914139142391433914439145391463914739148391493915039151391523915339154391553915639157391583915939160391613916239163391643916539166391673916839169391703917139172391733917439175391763917739178391793918039181391823918339184391853918639187391883918939190391913919239193391943919539196391973919839199392003920139202392033920439205392063920739208392093921039211392123921339214392153921639217392183921939220392213922239223392243922539226392273922839229392303923139232392333923439235392363923739238392393924039241392423924339244392453924639247392483924939250392513925239253392543925539256392573925839259392603926139262392633926439265392663926739268392693927039271392723927339274392753927639277392783927939280392813928239283392843928539286392873928839289392903929139292392933929439295392963929739298392993930039301393023930339304393053930639307393083930939310393113931239313393143931539316393173931839319393203932139322393233932439325393263932739328393293933039331393323933339334393353933639337393383933939340393413934239343393443934539346393473934839349393503935139352393533935439355393563935739358393593936039361393623936339364393653936639367393683936939370393713937239373393743937539376393773937839379393803938139382393833938439385393863938739388393893939039391393923939339394393953939639397393983939939400394013940239403394043940539406394073940839409394103941139412394133941439415394163941739418394193942039421394223942339424394253942639427394283942939430394313943239433394343943539436394373943839439394403944139442394433944439445394463944739448394493945039451394523945339454394553945639457394583945939460394613946239463394643946539466394673946839469394703947139472394733947439475394763947739478394793948039481394823948339484394853948639487394883948939490394913949239493394943949539496394973949839499395003950139502395033950439505395063950739508395093951039511395123951339514395153951639517395183951939520395213952239523395243952539526395273952839529395303953139532395333953439535395363953739538395393954039541395423954339544395453954639547395483954939550395513955239553395543955539556395573955839559395603956139562395633956439565395663956739568395693957039571395723957339574395753957639577395783957939580395813958239583395843958539586395873958839589395903959139592395933959439595395963959739598395993960039601396023960339604396053960639607396083960939610396113961239613396143961539616396173961839619396203962139622396233962439625396263962739628396293963039631396323963339634396353963639637396383963939640396413964239643396443964539646396473964839649396503965139652396533965439655396563965739658396593966039661396623966339664396653966639667396683966939670396713967239673396743967539676396773967839679396803968139682396833968439685396863968739688396893969039691396923969339694396953969639697396983969939700397013970239703397043970539706397073970839709397103971139712397133971439715397163971739718397193972039721397223972339724397253972639727397283972939730397313973239733397343973539736397373973839739397403974139742397433974439745397463974739748397493975039751397523975339754397553975639757397583975939760397613976239763397643976539766397673976839769397703977139772397733977439775397763977739778397793978039781397823978339784397853978639787397883978939790397913979239793397943979539796397973979839799398003980139802398033980439805398063980739808398093981039811398123981339814398153981639817398183981939820398213982239823398243982539826398273982839829398303983139832398333983439835398363983739838398393984039841398423984339844398453984639847398483984939850398513985239853398543985539856398573985839859398603986139862398633986439865398663986739868398693987039871398723987339874398753987639877398783987939880398813988239883398843988539886398873988839889398903989139892398933989439895398963989739898398993990039901399023990339904399053990639907399083990939910399113991239913399143991539916399173991839919399203992139922399233992439925399263992739928399293993039931399323993339934399353993639937399383993939940399413994239943399443994539946399473994839949399503995139952399533995439955399563995739958399593996039961399623996339964399653996639967399683996939970399713997239973399743997539976399773997839979399803998139982399833998439985399863998739988399893999039991399923999339994399953999639997399983999940000400014000240003400044000540006400074000840009400104001140012400134001440015400164001740018400194002040021400224002340024400254002640027400284002940030400314003240033400344003540036400374003840039400404004140042400434004440045400464004740048400494005040051400524005340054400554005640057400584005940060400614006240063400644006540066400674006840069400704007140072400734007440075400764007740078400794008040081400824008340084400854008640087400884008940090400914009240093400944009540096400974009840099401004010140102401034010440105401064010740108401094011040111401124011340114401154011640117401184011940120401214012240123401244012540126401274012840129401304013140132401334013440135401364013740138401394014040141401424014340144401454014640147401484014940150401514015240153401544015540156401574015840159401604016140162401634016440165401664016740168401694017040171401724017340174401754017640177401784017940180401814018240183401844018540186401874018840189401904019140192401934019440195401964019740198401994020040201402024020340204402054020640207402084020940210402114021240213402144021540216402174021840219402204022140222402234022440225402264022740228402294023040231402324023340234402354023640237402384023940240402414024240243402444024540246402474024840249402504025140252402534025440255402564025740258402594026040261402624026340264402654026640267402684026940270402714027240273402744027540276402774027840279402804028140282402834028440285402864028740288402894029040291402924029340294402954029640297402984029940300403014030240303403044030540306403074030840309403104031140312403134031440315403164031740318403194032040321403224032340324403254032640327403284032940330403314033240333403344033540336403374033840339403404034140342403434034440345403464034740348403494035040351403524035340354403554035640357403584035940360403614036240363403644036540366403674036840369403704037140372403734037440375403764037740378403794038040381403824038340384403854038640387403884038940390403914039240393403944039540396403974039840399404004040140402404034040440405404064040740408404094041040411404124041340414404154041640417404184041940420404214042240423404244042540426404274042840429404304043140432404334043440435404364043740438404394044040441404424044340444404454044640447404484044940450404514045240453404544045540456404574045840459404604046140462404634046440465404664046740468404694047040471404724047340474404754047640477404784047940480404814048240483404844048540486404874048840489404904049140492404934049440495404964049740498404994050040501405024050340504405054050640507405084050940510405114051240513405144051540516405174051840519405204052140522405234052440525405264052740528405294053040531405324053340534405354053640537405384053940540405414054240543405444054540546405474054840549405504055140552405534055440555405564055740558405594056040561405624056340564405654056640567405684056940570405714057240573405744057540576405774057840579405804058140582405834058440585405864058740588405894059040591405924059340594405954059640597405984059940600406014060240603406044060540606406074060840609406104061140612406134061440615406164061740618406194062040621406224062340624406254062640627406284062940630406314063240633406344063540636406374063840639406404064140642406434064440645406464064740648406494065040651406524065340654406554065640657406584065940660406614066240663406644066540666406674066840669406704067140672406734067440675406764067740678406794068040681406824068340684406854068640687406884068940690406914069240693406944069540696406974069840699407004070140702407034070440705407064070740708407094071040711407124071340714407154071640717407184071940720407214072240723407244072540726407274072840729407304073140732407334073440735407364073740738407394074040741407424074340744407454074640747407484074940750407514075240753407544075540756407574075840759407604076140762407634076440765407664076740768407694077040771407724077340774407754077640777407784077940780407814078240783407844078540786407874078840789407904079140792407934079440795407964079740798407994080040801408024080340804408054080640807408084080940810408114081240813408144081540816408174081840819408204082140822408234082440825408264082740828408294083040831408324083340834408354083640837408384083940840408414084240843408444084540846408474084840849408504085140852408534085440855408564085740858408594086040861408624086340864408654086640867408684086940870408714087240873408744087540876408774087840879408804088140882408834088440885408864088740888408894089040891408924089340894408954089640897408984089940900409014090240903409044090540906409074090840909409104091140912409134091440915409164091740918409194092040921409224092340924409254092640927409284092940930409314093240933409344093540936409374093840939409404094140942409434094440945409464094740948409494095040951409524095340954409554095640957409584095940960409614096240963409644096540966409674096840969409704097140972409734097440975409764097740978409794098040981409824098340984409854098640987409884098940990409914099240993409944099540996409974099840999410004100141002410034100441005410064100741008410094101041011410124101341014410154101641017410184101941020410214102241023410244102541026410274102841029410304103141032410334103441035410364103741038410394104041041410424104341044410454104641047410484104941050410514105241053410544105541056410574105841059410604106141062410634106441065410664106741068410694107041071410724107341074410754107641077410784107941080410814108241083410844108541086410874108841089410904109141092410934109441095410964109741098410994110041101411024110341104411054110641107411084110941110411114111241113411144111541116411174111841119411204112141122411234112441125411264112741128411294113041131411324113341134411354113641137411384113941140411414114241143411444114541146411474114841149411504115141152411534115441155411564115741158411594116041161411624116341164411654116641167411684116941170411714117241173411744117541176411774117841179411804118141182411834118441185411864118741188411894119041191411924119341194411954119641197411984119941200412014120241203412044120541206412074120841209412104121141212412134121441215412164121741218412194122041221412224122341224412254122641227412284122941230412314123241233412344123541236412374123841239412404124141242412434124441245412464124741248412494125041251412524125341254412554125641257412584125941260412614126241263412644126541266412674126841269412704127141272412734127441275412764127741278412794128041281412824128341284412854128641287412884128941290412914129241293412944129541296412974129841299413004130141302413034130441305413064130741308413094131041311413124131341314413154131641317413184131941320413214132241323413244132541326413274132841329413304133141332413334133441335413364133741338413394134041341413424134341344413454134641347413484134941350413514135241353413544135541356413574135841359413604136141362413634136441365413664136741368413694137041371413724137341374413754137641377413784137941380413814138241383413844138541386413874138841389413904139141392413934139441395413964139741398413994140041401414024140341404414054140641407414084140941410414114141241413414144141541416414174141841419414204142141422414234142441425414264142741428414294143041431414324143341434414354143641437414384143941440414414144241443414444144541446414474144841449414504145141452414534145441455414564145741458414594146041461414624146341464414654146641467414684146941470414714147241473414744147541476414774147841479414804148141482414834148441485414864148741488414894149041491414924149341494414954149641497414984149941500415014150241503415044150541506415074150841509415104151141512415134151441515415164151741518415194152041521415224152341524415254152641527415284152941530415314153241533415344153541536415374153841539415404154141542415434154441545415464154741548415494155041551415524155341554415554155641557415584155941560415614156241563415644156541566415674156841569415704157141572415734157441575415764157741578415794158041581415824158341584415854158641587415884158941590415914159241593415944159541596415974159841599416004160141602416034160441605416064160741608416094161041611416124161341614416154161641617416184161941620416214162241623416244162541626416274162841629416304163141632416334163441635416364163741638416394164041641416424164341644416454164641647416484164941650416514165241653416544165541656416574165841659416604166141662416634166441665416664166741668416694167041671416724167341674416754167641677416784167941680416814168241683416844168541686416874168841689416904169141692416934169441695416964169741698416994170041701417024170341704417054170641707417084170941710417114171241713417144171541716417174171841719417204172141722417234172441725417264172741728417294173041731417324173341734417354173641737417384173941740417414174241743417444174541746417474174841749417504175141752417534175441755417564175741758417594176041761417624176341764417654176641767417684176941770417714177241773417744177541776417774177841779417804178141782417834178441785417864178741788417894179041791417924179341794417954179641797417984179941800418014180241803418044180541806418074180841809418104181141812418134181441815418164181741818418194182041821418224182341824418254182641827418284182941830418314183241833418344183541836418374183841839418404184141842418434184441845418464184741848418494185041851418524185341854418554185641857418584185941860418614186241863418644186541866418674186841869418704187141872418734187441875418764187741878418794188041881418824188341884418854188641887418884188941890418914189241893418944189541896418974189841899419004190141902419034190441905419064190741908419094191041911419124191341914419154191641917419184191941920419214192241923419244192541926419274192841929419304193141932419334193441935419364193741938419394194041941419424194341944419454194641947419484194941950419514195241953419544195541956419574195841959419604196141962419634196441965419664196741968419694197041971419724197341974419754197641977419784197941980419814198241983419844198541986419874198841989419904199141992419934199441995419964199741998419994200042001420024200342004420054200642007420084200942010420114201242013420144201542016420174201842019420204202142022420234202442025420264202742028420294203042031420324203342034420354203642037420384203942040420414204242043420444204542046420474204842049420504205142052420534205442055420564205742058420594206042061420624206342064420654206642067420684206942070420714207242073420744207542076420774207842079420804208142082420834208442085420864208742088420894209042091420924209342094420954209642097420984209942100421014210242103421044210542106421074210842109421104211142112421134211442115421164211742118421194212042121421224212342124421254212642127421284212942130421314213242133421344213542136421374213842139421404214142142421434214442145421464214742148421494215042151421524215342154421554215642157421584215942160421614216242163421644216542166421674216842169421704217142172421734217442175421764217742178421794218042181421824218342184421854218642187421884218942190421914219242193421944219542196421974219842199422004220142202422034220442205422064220742208422094221042211422124221342214422154221642217422184221942220422214222242223422244222542226422274222842229422304223142232422334223442235422364223742238422394224042241422424224342244422454224642247422484224942250422514225242253422544225542256422574225842259422604226142262422634226442265422664226742268422694227042271422724227342274422754227642277422784227942280422814228242283422844228542286422874228842289422904229142292422934229442295422964229742298422994230042301423024230342304423054230642307423084230942310423114231242313423144231542316423174231842319423204232142322423234232442325423264232742328423294233042331423324233342334423354233642337423384233942340423414234242343423444234542346423474234842349423504235142352423534235442355423564235742358423594236042361423624236342364423654236642367423684236942370423714237242373423744237542376423774237842379423804238142382423834238442385423864238742388423894239042391423924239342394423954239642397423984239942400424014240242403424044240542406424074240842409424104241142412424134241442415424164241742418424194242042421424224242342424424254242642427424284242942430424314243242433424344243542436424374243842439424404244142442424434244442445424464244742448424494245042451424524245342454424554245642457424584245942460424614246242463424644246542466424674246842469424704247142472424734247442475424764247742478424794248042481424824248342484424854248642487424884248942490424914249242493424944249542496424974249842499425004250142502425034250442505425064250742508425094251042511425124251342514425154251642517425184251942520425214252242523425244252542526425274252842529425304253142532425334253442535425364253742538425394254042541425424254342544425454254642547425484254942550425514255242553425544255542556425574255842559425604256142562425634256442565425664256742568425694257042571425724257342574425754257642577425784257942580425814258242583425844258542586425874258842589425904259142592425934259442595425964259742598425994260042601426024260342604426054260642607426084260942610426114261242613426144261542616426174261842619426204262142622426234262442625426264262742628426294263042631426324263342634426354263642637426384263942640426414264242643426444264542646426474264842649426504265142652426534265442655426564265742658426594266042661426624266342664426654266642667426684266942670426714267242673426744267542676426774267842679426804268142682426834268442685426864268742688426894269042691426924269342694426954269642697426984269942700427014270242703427044270542706427074270842709427104271142712427134271442715427164271742718427194272042721427224272342724427254272642727427284272942730427314273242733427344273542736427374273842739427404274142742427434274442745427464274742748427494275042751427524275342754427554275642757427584275942760427614276242763427644276542766427674276842769427704277142772427734277442775427764277742778427794278042781427824278342784427854278642787427884278942790427914279242793427944279542796427974279842799428004280142802428034280442805428064280742808428094281042811428124281342814428154281642817428184281942820428214282242823428244282542826428274282842829428304283142832428334283442835428364283742838428394284042841428424284342844428454284642847428484284942850428514285242853428544285542856428574285842859428604286142862428634286442865428664286742868428694287042871428724287342874428754287642877428784287942880428814288242883428844288542886428874288842889428904289142892428934289442895428964289742898428994290042901429024290342904429054290642907429084290942910429114291242913429144291542916429174291842919429204292142922429234292442925429264292742928429294293042931429324293342934429354293642937429384293942940429414294242943429444294542946429474294842949429504295142952429534295442955429564295742958429594296042961429624296342964429654296642967429684296942970429714297242973429744297542976429774297842979429804298142982429834298442985429864298742988429894299042991429924299342994429954299642997429984299943000430014300243003430044300543006430074300843009430104301143012430134301443015430164301743018430194302043021430224302343024430254302643027430284302943030430314303243033430344303543036430374303843039430404304143042430434304443045430464304743048430494305043051430524305343054430554305643057430584305943060430614306243063430644306543066430674306843069430704307143072430734307443075430764307743078430794308043081430824308343084430854308643087430884308943090430914309243093430944309543096430974309843099431004310143102431034310443105431064310743108431094311043111431124311343114431154311643117431184311943120431214312243123431244312543126431274312843129431304313143132431334313443135431364313743138431394314043141431424314343144431454314643147431484314943150431514315243153431544315543156431574315843159431604316143162431634316443165431664316743168431694317043171431724317343174431754317643177431784317943180431814318243183431844318543186431874318843189431904319143192431934319443195431964319743198431994320043201432024320343204432054320643207432084320943210432114321243213432144321543216432174321843219432204322143222432234322443225432264322743228432294323043231432324323343234432354323643237432384323943240432414324243243432444324543246432474324843249432504325143252432534325443255432564325743258432594326043261432624326343264432654326643267432684326943270432714327243273432744327543276432774327843279432804328143282432834328443285432864328743288432894329043291432924329343294432954329643297432984329943300433014330243303433044330543306433074330843309433104331143312433134331443315433164331743318433194332043321433224332343324433254332643327433284332943330433314333243333433344333543336433374333843339433404334143342433434334443345433464334743348433494335043351433524335343354433554335643357433584335943360433614336243363433644336543366433674336843369433704337143372433734337443375433764337743378433794338043381433824338343384433854338643387433884338943390433914339243393433944339543396433974339843399434004340143402434034340443405434064340743408434094341043411434124341343414434154341643417434184341943420434214342243423434244342543426434274342843429434304343143432434334343443435434364343743438434394344043441434424344343444434454344643447434484344943450434514345243453434544345543456434574345843459434604346143462434634346443465434664346743468434694347043471434724347343474434754347643477434784347943480434814348243483434844348543486434874348843489434904349143492434934349443495434964349743498434994350043501435024350343504435054350643507435084350943510435114351243513435144351543516435174351843519435204352143522435234352443525435264352743528435294353043531435324353343534435354353643537435384353943540435414354243543435444354543546435474354843549435504355143552435534355443555435564355743558435594356043561435624356343564435654356643567435684356943570435714357243573435744357543576435774357843579435804358143582435834358443585435864358743588435894359043591435924359343594435954359643597435984359943600436014360243603436044360543606436074360843609436104361143612436134361443615436164361743618436194362043621436224362343624436254362643627436284362943630436314363243633436344363543636436374363843639436404364143642436434364443645436464364743648436494365043651436524365343654436554365643657436584365943660436614366243663436644366543666436674366843669436704367143672436734367443675436764367743678436794368043681436824368343684436854368643687436884368943690436914369243693436944369543696436974369843699437004370143702437034370443705437064370743708437094371043711437124371343714437154371643717437184371943720437214372243723437244372543726437274372843729437304373143732437334373443735437364373743738437394374043741437424374343744437454374643747437484374943750437514375243753437544375543756437574375843759437604376143762437634376443765437664376743768437694377043771437724377343774437754377643777437784377943780437814378243783437844378543786437874378843789437904379143792437934379443795437964379743798437994380043801438024380343804438054380643807438084380943810438114381243813438144381543816438174381843819438204382143822438234382443825438264382743828438294383043831438324383343834438354383643837438384383943840438414384243843438444384543846438474384843849438504385143852438534385443855438564385743858438594386043861438624386343864438654386643867438684386943870438714387243873438744387543876438774387843879438804388143882438834388443885438864388743888438894389043891438924389343894438954389643897438984389943900439014390243903439044390543906439074390843909439104391143912439134391443915439164391743918439194392043921439224392343924439254392643927439284392943930439314393243933439344393543936439374393843939439404394143942439434394443945439464394743948439494395043951439524395343954439554395643957439584395943960439614396243963439644396543966439674396843969439704397143972439734397443975439764397743978439794398043981439824398343984439854398643987439884398943990439914399243993439944399543996439974399843999440004400144002440034400444005440064400744008440094401044011440124401344014440154401644017440184401944020440214402244023440244402544026440274402844029440304403144032440334403444035440364403744038440394404044041440424404344044440454404644047440484404944050440514405244053440544405544056440574405844059440604406144062440634406444065440664406744068440694407044071440724407344074440754407644077440784407944080440814408244083440844408544086440874408844089440904409144092440934409444095440964409744098440994410044101441024410344104441054410644107441084410944110441114411244113441144411544116441174411844119441204412144122441234412444125441264412744128441294413044131441324413344134441354413644137441384413944140441414414244143441444414544146441474414844149441504415144152441534415444155441564415744158441594416044161441624416344164441654416644167441684416944170441714417244173441744417544176441774417844179441804418144182441834418444185441864418744188441894419044191441924419344194441954419644197441984419944200442014420244203442044420544206442074420844209442104421144212442134421444215442164421744218442194422044221442224422344224442254422644227442284422944230442314423244233442344423544236442374423844239442404424144242442434424444245442464424744248442494425044251442524425344254442554425644257442584425944260442614426244263442644426544266442674426844269442704427144272442734427444275442764427744278442794428044281442824428344284442854428644287442884428944290442914429244293442944429544296442974429844299443004430144302443034430444305443064430744308443094431044311443124431344314443154431644317443184431944320443214432244323443244432544326443274432844329443304433144332443334433444335443364433744338443394434044341443424434344344443454434644347443484434944350443514435244353443544435544356443574435844359443604436144362443634436444365443664436744368443694437044371443724437344374443754437644377443784437944380443814438244383443844438544386443874438844389443904439144392443934439444395443964439744398443994440044401444024440344404444054440644407444084440944410444114441244413444144441544416444174441844419444204442144422444234442444425444264442744428444294443044431444324443344434444354443644437444384443944440444414444244443444444444544446444474444844449444504445144452444534445444455444564445744458444594446044461444624446344464444654446644467444684446944470444714447244473444744447544476444774447844479444804448144482444834448444485444864448744488444894449044491444924449344494444954449644497444984449944500445014450244503445044450544506445074450844509445104451144512445134451444515445164451744518445194452044521445224452344524445254452644527445284452944530445314453244533445344453544536445374453844539445404454144542445434454444545445464454744548445494455044551445524455344554445554455644557445584455944560445614456244563445644456544566445674456844569445704457144572445734457444575445764457744578445794458044581445824458344584445854458644587445884458944590445914459244593445944459544596445974459844599446004460144602446034460444605446064460744608446094461044611446124461344614446154461644617446184461944620446214462244623446244462544626446274462844629446304463144632446334463444635446364463744638446394464044641446424464344644446454464644647446484464944650446514465244653446544465544656446574465844659446604466144662446634466444665446664466744668446694467044671446724467344674446754467644677446784467944680446814468244683446844468544686446874468844689446904469144692446934469444695446964469744698446994470044701447024470344704447054470644707447084470944710447114471244713447144471544716447174471844719447204472144722447234472444725447264472744728447294473044731447324473344734447354473644737447384473944740447414474244743447444474544746447474474844749447504475144752447534475444755447564475744758447594476044761447624476344764447654476644767447684476944770447714477244773447744477544776447774477844779447804478144782447834478444785447864478744788447894479044791447924479344794447954479644797447984479944800448014480244803448044480544806448074480844809448104481144812448134481444815448164481744818448194482044821448224482344824448254482644827448284482944830448314483244833448344483544836448374483844839448404484144842448434484444845448464484744848448494485044851448524485344854448554485644857448584485944860448614486244863448644486544866448674486844869448704487144872448734487444875448764487744878448794488044881448824488344884448854488644887448884488944890448914489244893448944489544896448974489844899449004490144902449034490444905449064490744908449094491044911449124491344914449154491644917449184491944920449214492244923449244492544926449274492844929449304493144932449334493444935449364493744938449394494044941449424494344944449454494644947449484494944950449514495244953449544495544956449574495844959449604496144962449634496444965449664496744968449694497044971449724497344974449754497644977449784497944980449814498244983449844498544986449874498844989449904499144992449934499444995449964499744998449994500045001450024500345004450054500645007450084500945010450114501245013450144501545016450174501845019450204502145022450234502445025450264502745028450294503045031450324503345034450354503645037450384503945040450414504245043450444504545046450474504845049450504505145052450534505445055450564505745058450594506045061450624506345064450654506645067450684506945070450714507245073450744507545076450774507845079450804508145082450834508445085450864508745088450894509045091450924509345094450954509645097450984509945100451014510245103451044510545106451074510845109451104511145112451134511445115451164511745118451194512045121451224512345124451254512645127451284512945130451314513245133451344513545136451374513845139451404514145142451434514445145451464514745148451494515045151451524515345154451554515645157451584515945160451614516245163451644516545166451674516845169451704517145172451734517445175451764517745178451794518045181451824518345184451854518645187451884518945190451914519245193451944519545196451974519845199452004520145202452034520445205452064520745208452094521045211452124521345214452154521645217452184521945220452214522245223452244522545226452274522845229452304523145232452334523445235452364523745238452394524045241452424524345244452454524645247452484524945250452514525245253452544525545256452574525845259452604526145262452634526445265452664526745268452694527045271452724527345274452754527645277452784527945280452814528245283452844528545286452874528845289452904529145292452934529445295452964529745298452994530045301453024530345304453054530645307453084530945310453114531245313453144531545316453174531845319453204532145322453234532445325453264532745328453294533045331453324533345334453354533645337453384533945340453414534245343453444534545346453474534845349453504535145352453534535445355453564535745358453594536045361453624536345364453654536645367453684536945370453714537245373453744537545376453774537845379453804538145382453834538445385453864538745388453894539045391453924539345394453954539645397453984539945400454014540245403454044540545406454074540845409454104541145412454134541445415454164541745418454194542045421454224542345424454254542645427454284542945430454314543245433454344543545436454374543845439454404544145442454434544445445454464544745448454494545045451454524545345454454554545645457454584545945460454614546245463454644546545466454674546845469454704547145472454734547445475454764547745478454794548045481454824548345484454854548645487454884548945490454914549245493454944549545496454974549845499455004550145502455034550445505455064550745508455094551045511455124551345514455154551645517455184551945520455214552245523455244552545526455274552845529455304553145532455334553445535455364553745538455394554045541455424554345544455454554645547455484554945550455514555245553455544555545556455574555845559455604556145562455634556445565455664556745568455694557045571455724557345574455754557645577455784557945580455814558245583455844558545586455874558845589455904559145592455934559445595455964559745598455994560045601456024560345604456054560645607456084560945610456114561245613456144561545616456174561845619456204562145622456234562445625456264562745628456294563045631456324563345634456354563645637456384563945640456414564245643456444564545646456474564845649456504565145652456534565445655456564565745658456594566045661456624566345664456654566645667456684566945670456714567245673456744567545676456774567845679456804568145682456834568445685456864568745688456894569045691456924569345694456954569645697456984569945700457014570245703457044570545706457074570845709457104571145712457134571445715457164571745718457194572045721457224572345724457254572645727457284572945730457314573245733457344573545736457374573845739457404574145742457434574445745457464574745748457494575045751457524575345754457554575645757457584575945760457614576245763457644576545766457674576845769457704577145772457734577445775457764577745778457794578045781457824578345784457854578645787457884578945790457914579245793457944579545796457974579845799458004580145802458034580445805458064580745808458094581045811458124581345814458154581645817458184581945820458214582245823458244582545826458274582845829458304583145832458334583445835458364583745838458394584045841458424584345844458454584645847458484584945850458514585245853458544585545856458574585845859458604586145862458634586445865458664586745868458694587045871458724587345874458754587645877458784587945880458814588245883458844588545886458874588845889458904589145892458934589445895458964589745898458994590045901459024590345904459054590645907459084590945910459114591245913459144591545916459174591845919459204592145922459234592445925459264592745928459294593045931459324593345934459354593645937459384593945940459414594245943459444594545946459474594845949459504595145952459534595445955459564595745958459594596045961459624596345964459654596645967459684596945970459714597245973459744597545976459774597845979459804598145982459834598445985459864598745988459894599045991459924599345994459954599645997459984599946000460014600246003460044600546006460074600846009460104601146012460134601446015460164601746018460194602046021460224602346024460254602646027460284602946030460314603246033460344603546036460374603846039460404604146042460434604446045460464604746048460494605046051460524605346054460554605646057460584605946060460614606246063460644606546066460674606846069460704607146072460734607446075460764607746078460794608046081460824608346084460854608646087460884608946090460914609246093460944609546096460974609846099461004610146102461034610446105461064610746108461094611046111461124611346114461154611646117461184611946120461214612246123461244612546126461274612846129461304613146132461334613446135461364613746138461394614046141461424614346144461454614646147461484614946150461514615246153461544615546156461574615846159461604616146162461634616446165461664616746168461694617046171461724617346174461754617646177461784617946180461814618246183461844618546186461874618846189461904619146192461934619446195461964619746198461994620046201462024620346204462054620646207462084620946210462114621246213462144621546216462174621846219462204622146222462234622446225462264622746228462294623046231462324623346234462354623646237462384623946240462414624246243462444624546246462474624846249462504625146252462534625446255462564625746258462594626046261462624626346264462654626646267462684626946270462714627246273462744627546276462774627846279462804628146282462834628446285462864628746288462894629046291462924629346294462954629646297462984629946300463014630246303463044630546306463074630846309463104631146312463134631446315463164631746318463194632046321463224632346324463254632646327463284632946330463314633246333463344633546336463374633846339463404634146342463434634446345463464634746348463494635046351463524635346354463554635646357463584635946360463614636246363463644636546366463674636846369463704637146372463734637446375463764637746378463794638046381463824638346384463854638646387463884638946390463914639246393463944639546396463974639846399464004640146402464034640446405464064640746408464094641046411464124641346414464154641646417464184641946420464214642246423464244642546426464274642846429464304643146432464334643446435464364643746438464394644046441464424644346444464454644646447464484644946450464514645246453464544645546456464574645846459464604646146462464634646446465464664646746468464694647046471464724647346474464754647646477464784647946480464814648246483464844648546486464874648846489464904649146492464934649446495464964649746498464994650046501465024650346504465054650646507465084650946510465114651246513465144651546516465174651846519465204652146522465234652446525465264652746528465294653046531465324653346534465354653646537465384653946540465414654246543465444654546546465474654846549465504655146552465534655446555465564655746558465594656046561465624656346564465654656646567465684656946570465714657246573465744657546576465774657846579465804658146582465834658446585465864658746588465894659046591465924659346594465954659646597465984659946600466014660246603466044660546606466074660846609466104661146612466134661446615466164661746618466194662046621466224662346624466254662646627466284662946630466314663246633466344663546636466374663846639466404664146642466434664446645466464664746648466494665046651466524665346654466554665646657466584665946660466614666246663466644666546666466674666846669466704667146672466734667446675466764667746678466794668046681466824668346684466854668646687466884668946690466914669246693466944669546696466974669846699467004670146702467034670446705467064670746708467094671046711467124671346714467154671646717467184671946720467214672246723467244672546726467274672846729467304673146732467334673446735467364673746738467394674046741467424674346744467454674646747467484674946750467514675246753467544675546756467574675846759467604676146762467634676446765467664676746768467694677046771467724677346774467754677646777467784677946780467814678246783467844678546786467874678846789467904679146792467934679446795467964679746798467994680046801468024680346804468054680646807468084680946810468114681246813468144681546816468174681846819468204682146822468234682446825468264682746828468294683046831468324683346834468354683646837468384683946840468414684246843468444684546846468474684846849468504685146852468534685446855468564685746858468594686046861468624686346864468654686646867468684686946870468714687246873468744687546876468774687846879468804688146882468834688446885468864688746888468894689046891468924689346894468954689646897468984689946900469014690246903469044690546906469074690846909469104691146912469134691446915469164691746918469194692046921469224692346924469254692646927469284692946930469314693246933469344693546936469374693846939469404694146942469434694446945469464694746948469494695046951469524695346954469554695646957469584695946960469614696246963469644696546966469674696846969469704697146972469734697446975469764697746978469794698046981469824698346984469854698646987469884698946990469914699246993469944699546996469974699846999470004700147002470034700447005470064700747008470094701047011470124701347014470154701647017470184701947020470214702247023470244702547026470274702847029470304703147032470334703447035470364703747038470394704047041470424704347044470454704647047470484704947050470514705247053470544705547056470574705847059470604706147062470634706447065470664706747068470694707047071470724707347074470754707647077470784707947080470814708247083470844708547086470874708847089470904709147092470934709447095470964709747098470994710047101471024710347104471054710647107471084710947110471114711247113471144711547116471174711847119471204712147122471234712447125471264712747128471294713047131471324713347134471354713647137471384713947140471414714247143471444714547146471474714847149471504715147152471534715447155471564715747158471594716047161471624716347164471654716647167471684716947170471714717247173471744717547176471774717847179471804718147182471834718447185471864718747188471894719047191471924719347194471954719647197471984719947200472014720247203472044720547206472074720847209472104721147212472134721447215472164721747218472194722047221472224722347224472254722647227472284722947230472314723247233472344723547236472374723847239472404724147242472434724447245472464724747248472494725047251472524725347254472554725647257472584725947260472614726247263472644726547266472674726847269472704727147272472734727447275472764727747278472794728047281472824728347284472854728647287472884728947290472914729247293472944729547296472974729847299473004730147302473034730447305473064730747308473094731047311473124731347314473154731647317473184731947320473214732247323473244732547326473274732847329473304733147332473334733447335473364733747338473394734047341473424734347344473454734647347473484734947350473514735247353473544735547356473574735847359473604736147362473634736447365473664736747368473694737047371473724737347374473754737647377473784737947380473814738247383473844738547386473874738847389473904739147392473934739447395473964739747398473994740047401474024740347404474054740647407474084740947410474114741247413474144741547416474174741847419474204742147422474234742447425474264742747428474294743047431474324743347434474354743647437474384743947440474414744247443474444744547446474474744847449474504745147452474534745447455474564745747458474594746047461474624746347464474654746647467474684746947470474714747247473474744747547476474774747847479474804748147482474834748447485474864748747488474894749047491474924749347494474954749647497474984749947500475014750247503475044750547506475074750847509475104751147512475134751447515475164751747518475194752047521475224752347524475254752647527475284752947530475314753247533475344753547536475374753847539475404754147542475434754447545475464754747548475494755047551475524755347554475554755647557475584755947560475614756247563475644756547566475674756847569475704757147572475734757447575475764757747578475794758047581475824758347584475854758647587475884758947590475914759247593475944759547596475974759847599476004760147602476034760447605476064760747608476094761047611476124761347614476154761647617476184761947620476214762247623476244762547626476274762847629476304763147632476334763447635476364763747638476394764047641476424764347644476454764647647476484764947650476514765247653476544765547656476574765847659476604766147662476634766447665476664766747668476694767047671476724767347674476754767647677476784767947680476814768247683476844768547686476874768847689476904769147692476934769447695476964769747698476994770047701477024770347704477054770647707477084770947710477114771247713477144771547716477174771847719477204772147722477234772447725477264772747728477294773047731477324773347734477354773647737477384773947740477414774247743477444774547746477474774847749477504775147752477534775447755477564775747758477594776047761477624776347764477654776647767477684776947770477714777247773477744777547776477774777847779477804778147782477834778447785477864778747788477894779047791477924779347794477954779647797477984779947800478014780247803478044780547806478074780847809478104781147812478134781447815478164781747818478194782047821478224782347824478254782647827478284782947830478314783247833478344783547836478374783847839478404784147842478434784447845478464784747848478494785047851478524785347854478554785647857478584785947860478614786247863478644786547866478674786847869478704787147872478734787447875478764787747878478794788047881478824788347884478854788647887478884788947890478914789247893478944789547896478974789847899479004790147902479034790447905479064790747908479094791047911479124791347914479154791647917479184791947920479214792247923479244792547926479274792847929479304793147932479334793447935479364793747938479394794047941479424794347944479454794647947479484794947950479514795247953479544795547956479574795847959479604796147962479634796447965479664796747968479694797047971479724797347974479754797647977479784797947980479814798247983479844798547986479874798847989479904799147992479934799447995479964799747998479994800048001480024800348004480054800648007480084800948010480114801248013480144801548016480174801848019480204802148022480234802448025480264802748028480294803048031480324803348034480354803648037480384803948040480414804248043480444804548046480474804848049480504805148052480534805448055480564805748058480594806048061480624806348064480654806648067480684806948070480714807248073480744807548076480774807848079480804808148082480834808448085480864808748088480894809048091480924809348094480954809648097480984809948100481014810248103481044810548106481074810848109481104811148112481134811448115481164811748118481194812048121481224812348124481254812648127481284812948130481314813248133481344813548136481374813848139481404814148142481434814448145481464814748148481494815048151481524815348154481554815648157481584815948160481614816248163481644816548166481674816848169481704817148172481734817448175481764817748178481794818048181481824818348184481854818648187481884818948190481914819248193481944819548196481974819848199482004820148202482034820448205482064820748208482094821048211482124821348214482154821648217482184821948220482214822248223482244822548226482274822848229482304823148232482334823448235482364823748238482394824048241482424824348244482454824648247482484824948250482514825248253482544825548256482574825848259482604826148262482634826448265482664826748268482694827048271482724827348274482754827648277482784827948280482814828248283482844828548286482874828848289482904829148292482934829448295482964829748298482994830048301483024830348304483054830648307483084830948310483114831248313483144831548316483174831848319483204832148322483234832448325483264832748328483294833048331483324833348334483354833648337483384833948340483414834248343483444834548346483474834848349483504835148352483534835448355483564835748358483594836048361483624836348364483654836648367483684836948370483714837248373483744837548376483774837848379483804838148382483834838448385483864838748388483894839048391483924839348394483954839648397483984839948400484014840248403484044840548406484074840848409484104841148412484134841448415484164841748418484194842048421484224842348424484254842648427484284842948430484314843248433484344843548436484374843848439484404844148442484434844448445484464844748448484494845048451484524845348454484554845648457484584845948460484614846248463484644846548466484674846848469484704847148472484734847448475484764847748478484794848048481484824848348484484854848648487484884848948490484914849248493484944849548496484974849848499485004850148502485034850448505485064850748508485094851048511485124851348514485154851648517485184851948520485214852248523485244852548526485274852848529485304853148532485334853448535485364853748538485394854048541485424854348544485454854648547485484854948550485514855248553485544855548556485574855848559485604856148562485634856448565485664856748568485694857048571485724857348574485754857648577485784857948580485814858248583485844858548586485874858848589485904859148592485934859448595485964859748598485994860048601486024860348604486054860648607486084860948610486114861248613486144861548616486174861848619486204862148622486234862448625486264862748628486294863048631486324863348634486354863648637486384863948640486414864248643486444864548646486474864848649486504865148652486534865448655486564865748658486594866048661486624866348664486654866648667486684866948670486714867248673486744867548676486774867848679486804868148682486834868448685486864868748688486894869048691486924869348694486954869648697486984869948700487014870248703487044870548706487074870848709487104871148712487134871448715487164871748718487194872048721487224872348724487254872648727487284872948730487314873248733487344873548736487374873848739487404874148742487434874448745487464874748748487494875048751487524875348754487554875648757487584875948760487614876248763487644876548766487674876848769487704877148772487734877448775487764877748778487794878048781487824878348784487854878648787487884878948790487914879248793487944879548796487974879848799488004880148802488034880448805488064880748808488094881048811488124881348814488154881648817488184881948820488214882248823488244882548826488274882848829488304883148832488334883448835488364883748838488394884048841488424884348844488454884648847488484884948850488514885248853488544885548856488574885848859488604886148862488634886448865488664886748868488694887048871488724887348874488754887648877488784887948880488814888248883488844888548886488874888848889488904889148892488934889448895488964889748898488994890048901489024890348904489054890648907489084890948910489114891248913489144891548916489174891848919489204892148922489234892448925489264892748928489294893048931489324893348934489354893648937489384893948940489414894248943489444894548946489474894848949489504895148952489534895448955489564895748958489594896048961489624896348964489654896648967489684896948970489714897248973489744897548976489774897848979489804898148982489834898448985489864898748988489894899048991489924899348994489954899648997489984899949000490014900249003490044900549006490074900849009490104901149012490134901449015490164901749018490194902049021490224902349024490254902649027490284902949030490314903249033490344903549036490374903849039490404904149042490434904449045490464904749048490494905049051490524905349054490554905649057490584905949060490614906249063490644906549066490674906849069490704907149072490734907449075490764907749078490794908049081490824908349084490854908649087490884908949090490914909249093490944909549096490974909849099491004910149102491034910449105491064910749108491094911049111491124911349114491154911649117491184911949120491214912249123491244912549126491274912849129491304913149132491334913449135491364913749138491394914049141491424914349144491454914649147491484914949150491514915249153491544915549156491574915849159491604916149162491634916449165491664916749168491694917049171491724917349174491754917649177491784917949180491814918249183491844918549186491874918849189491904919149192491934919449195491964919749198491994920049201492024920349204492054920649207492084920949210492114921249213492144921549216492174921849219492204922149222492234922449225492264922749228492294923049231492324923349234492354923649237492384923949240492414924249243492444924549246492474924849249492504925149252492534925449255492564925749258492594926049261492624926349264492654926649267492684926949270492714927249273492744927549276492774927849279492804928149282492834928449285492864928749288492894929049291492924929349294492954929649297492984929949300493014930249303493044930549306493074930849309493104931149312493134931449315493164931749318493194932049321493224932349324493254932649327493284932949330493314933249333493344933549336493374933849339493404934149342493434934449345493464934749348493494935049351493524935349354493554935649357493584935949360493614936249363493644936549366493674936849369493704937149372493734937449375493764937749378493794938049381493824938349384493854938649387493884938949390493914939249393493944939549396493974939849399494004940149402494034940449405494064940749408494094941049411494124941349414494154941649417494184941949420494214942249423494244942549426494274942849429494304943149432494334943449435494364943749438494394944049441494424944349444494454944649447494484944949450494514945249453494544945549456494574945849459494604946149462494634946449465494664946749468494694947049471494724947349474494754947649477494784947949480494814948249483494844948549486494874948849489494904949149492494934949449495494964949749498494994950049501495024950349504495054950649507495084950949510495114951249513495144951549516495174951849519495204952149522495234952449525495264952749528495294953049531495324953349534495354953649537495384953949540495414954249543495444954549546495474954849549495504955149552495534955449555495564955749558495594956049561495624956349564495654956649567495684956949570495714957249573495744957549576495774957849579495804958149582495834958449585495864958749588495894959049591495924959349594495954959649597495984959949600496014960249603496044960549606496074960849609496104961149612496134961449615496164961749618496194962049621496224962349624496254962649627496284962949630496314963249633496344963549636496374963849639496404964149642496434964449645496464964749648496494965049651496524965349654496554965649657496584965949660496614966249663496644966549666496674966849669496704967149672496734967449675496764967749678496794968049681496824968349684496854968649687496884968949690496914969249693496944969549696496974969849699497004970149702497034970449705497064970749708497094971049711497124971349714497154971649717497184971949720497214972249723497244972549726497274972849729497304973149732497334973449735497364973749738497394974049741497424974349744497454974649747497484974949750497514975249753497544975549756497574975849759497604976149762497634976449765497664976749768497694977049771497724977349774497754977649777497784977949780497814978249783497844978549786497874978849789497904979149792497934979449795497964979749798497994980049801498024980349804498054980649807498084980949810498114981249813498144981549816498174981849819498204982149822498234982449825498264982749828498294983049831498324983349834498354983649837498384983949840498414984249843498444984549846498474984849849498504985149852498534985449855498564985749858498594986049861498624986349864498654986649867498684986949870498714987249873498744987549876498774987849879498804988149882498834988449885498864988749888498894989049891498924989349894498954989649897498984989949900499014990249903499044990549906499074990849909499104991149912499134991449915499164991749918499194992049921499224992349924499254992649927499284992949930499314993249933499344993549936499374993849939499404994149942499434994449945499464994749948499494995049951499524995349954499554995649957499584995949960499614996249963499644996549966499674996849969499704997149972499734997449975499764997749978499794998049981499824998349984499854998649987499884998949990499914999249993499944999549996499974999849999500005000150002500035000450005500065000750008500095001050011500125001350014500155001650017500185001950020500215002250023500245002550026500275002850029500305003150032500335003450035500365003750038500395004050041500425004350044500455004650047500485004950050500515005250053500545005550056500575005850059500605006150062500635006450065500665006750068500695007050071500725007350074500755007650077500785007950080500815008250083500845008550086500875008850089500905009150092500935009450095500965009750098500995010050101501025010350104501055010650107501085010950110501115011250113501145011550116501175011850119501205012150122501235012450125501265012750128501295013050131501325013350134501355013650137501385013950140501415014250143501445014550146501475014850149501505015150152501535015450155501565015750158501595016050161501625016350164501655016650167501685016950170501715017250173501745017550176501775017850179501805018150182501835018450185501865018750188501895019050191501925019350194501955019650197501985019950200502015020250203502045020550206502075020850209502105021150212502135021450215502165021750218502195022050221502225022350224502255022650227502285022950230502315023250233502345023550236502375023850239502405024150242502435024450245502465024750248502495025050251502525025350254502555025650257502585025950260502615026250263502645026550266502675026850269502705027150272502735027450275502765027750278502795028050281502825028350284502855028650287502885028950290502915029250293502945029550296502975029850299503005030150302503035030450305503065030750308503095031050311503125031350314503155031650317503185031950320503215032250323503245032550326503275032850329503305033150332503335033450335503365033750338503395034050341503425034350344503455034650347503485034950350503515035250353503545035550356503575035850359503605036150362503635036450365503665036750368503695037050371503725037350374503755037650377503785037950380503815038250383503845038550386503875038850389503905039150392503935039450395503965039750398503995040050401504025040350404504055040650407504085040950410504115041250413504145041550416504175041850419504205042150422504235042450425504265042750428504295043050431504325043350434504355043650437504385043950440504415044250443504445044550446504475044850449504505045150452504535045450455504565045750458504595046050461504625046350464504655046650467504685046950470504715047250473504745047550476504775047850479504805048150482504835048450485504865048750488504895049050491504925049350494504955049650497504985049950500505015050250503505045050550506505075050850509505105051150512505135051450515505165051750518505195052050521505225052350524505255052650527505285052950530505315053250533505345053550536505375053850539505405054150542505435054450545505465054750548505495055050551505525055350554505555055650557505585055950560505615056250563505645056550566505675056850569505705057150572505735057450575505765057750578505795058050581505825058350584505855058650587505885058950590505915059250593505945059550596505975059850599506005060150602506035060450605506065060750608506095061050611506125061350614506155061650617506185061950620506215062250623506245062550626506275062850629506305063150632506335063450635506365063750638506395064050641506425064350644506455064650647506485064950650506515065250653506545065550656506575065850659506605066150662506635066450665506665066750668506695067050671506725067350674506755067650677506785067950680506815068250683506845068550686506875068850689506905069150692506935069450695506965069750698506995070050701507025070350704507055070650707507085070950710507115071250713507145071550716507175071850719507205072150722507235072450725507265072750728507295073050731507325073350734507355073650737507385073950740507415074250743507445074550746507475074850749507505075150752507535075450755507565075750758507595076050761507625076350764507655076650767507685076950770507715077250773507745077550776507775077850779507805078150782507835078450785507865078750788507895079050791507925079350794507955079650797507985079950800508015080250803508045080550806508075080850809508105081150812508135081450815508165081750818508195082050821508225082350824508255082650827508285082950830508315083250833508345083550836508375083850839508405084150842508435084450845508465084750848508495085050851508525085350854508555085650857508585085950860508615086250863508645086550866508675086850869508705087150872508735087450875508765087750878508795088050881508825088350884508855088650887508885088950890508915089250893508945089550896508975089850899509005090150902509035090450905509065090750908509095091050911509125091350914509155091650917509185091950920509215092250923509245092550926509275092850929509305093150932509335093450935509365093750938509395094050941509425094350944509455094650947509485094950950509515095250953509545095550956509575095850959509605096150962509635096450965509665096750968509695097050971509725097350974509755097650977509785097950980509815098250983509845098550986509875098850989509905099150992509935099450995509965099750998509995100051001510025100351004510055100651007510085100951010510115101251013510145101551016510175101851019510205102151022510235102451025510265102751028510295103051031510325103351034510355103651037510385103951040510415104251043510445104551046510475104851049510505105151052510535105451055510565105751058510595106051061510625106351064510655106651067510685106951070510715107251073510745107551076510775107851079510805108151082510835108451085510865108751088510895109051091510925109351094510955109651097510985109951100511015110251103511045110551106511075110851109511105111151112511135111451115511165111751118511195112051121511225112351124511255112651127511285112951130511315113251133511345113551136511375113851139511405114151142511435114451145511465114751148511495115051151511525115351154511555115651157511585115951160511615116251163511645116551166511675116851169511705117151172511735117451175511765117751178511795118051181511825118351184511855118651187511885118951190511915119251193511945119551196511975119851199512005120151202512035120451205512065120751208512095121051211512125121351214512155121651217512185121951220512215122251223512245122551226512275122851229512305123151232512335123451235512365123751238512395124051241512425124351244512455124651247512485124951250512515125251253512545125551256512575125851259512605126151262512635126451265512665126751268512695127051271512725127351274512755127651277512785127951280512815128251283512845128551286512875128851289512905129151292512935129451295512965129751298512995130051301513025130351304513055130651307513085130951310513115131251313513145131551316513175131851319513205132151322513235132451325513265132751328513295133051331513325133351334513355133651337513385133951340513415134251343513445134551346513475134851349513505135151352513535135451355513565135751358513595136051361513625136351364513655136651367513685136951370513715137251373513745137551376513775137851379513805138151382513835138451385513865138751388513895139051391513925139351394513955139651397513985139951400514015140251403514045140551406514075140851409514105141151412514135141451415514165141751418514195142051421514225142351424514255142651427514285142951430514315143251433514345143551436514375143851439514405144151442514435144451445514465144751448514495145051451514525145351454514555145651457514585145951460514615146251463514645146551466514675146851469514705147151472514735147451475514765147751478514795148051481514825148351484514855148651487514885148951490514915149251493514945149551496514975149851499515005150151502515035150451505515065150751508515095151051511515125151351514515155151651517515185151951520515215152251523515245152551526515275152851529515305153151532515335153451535515365153751538515395154051541515425154351544515455154651547515485154951550515515155251553515545155551556515575155851559515605156151562515635156451565515665156751568515695157051571515725157351574515755157651577515785157951580515815158251583515845158551586515875158851589515905159151592515935159451595515965159751598515995160051601516025160351604516055160651607516085160951610516115161251613516145161551616516175161851619516205162151622516235162451625516265162751628516295163051631516325163351634516355163651637516385163951640516415164251643516445164551646516475164851649516505165151652516535165451655516565165751658516595166051661516625166351664516655166651667516685166951670516715167251673516745167551676516775167851679516805168151682516835168451685516865168751688516895169051691516925169351694516955169651697516985169951700517015170251703517045170551706517075170851709517105171151712517135171451715517165171751718517195172051721517225172351724517255172651727517285172951730517315173251733517345173551736517375173851739517405174151742517435174451745517465174751748517495175051751517525175351754517555175651757517585175951760517615176251763517645176551766517675176851769517705177151772517735177451775517765177751778517795178051781517825178351784517855178651787517885178951790517915179251793517945179551796517975179851799518005180151802518035180451805518065180751808518095181051811518125181351814518155181651817518185181951820518215182251823518245182551826518275182851829518305183151832518335183451835518365183751838518395184051841518425184351844518455184651847518485184951850518515185251853518545185551856518575185851859518605186151862518635186451865518665186751868518695187051871518725187351874518755187651877518785187951880518815188251883518845188551886518875188851889518905189151892518935189451895518965189751898518995190051901519025190351904519055190651907519085190951910519115191251913519145191551916519175191851919519205192151922519235192451925519265192751928519295193051931519325193351934519355193651937519385193951940519415194251943519445194551946519475194851949519505195151952519535195451955519565195751958519595196051961519625196351964519655196651967519685196951970519715197251973519745197551976519775197851979519805198151982519835198451985519865198751988519895199051991519925199351994519955199651997519985199952000520015200252003520045200552006520075200852009520105201152012520135201452015520165201752018520195202052021520225202352024520255202652027520285202952030520315203252033520345203552036520375203852039520405204152042520435204452045520465204752048520495205052051520525205352054520555205652057520585205952060520615206252063520645206552066520675206852069520705207152072520735207452075520765207752078520795208052081520825208352084520855208652087520885208952090520915209252093520945209552096520975209852099521005210152102521035210452105521065210752108521095211052111521125211352114521155211652117521185211952120521215212252123521245212552126521275212852129521305213152132521335213452135521365213752138521395214052141521425214352144521455214652147521485214952150521515215252153521545215552156521575215852159521605216152162521635216452165521665216752168521695217052171521725217352174521755217652177521785217952180521815218252183521845218552186521875218852189521905219152192521935219452195521965219752198521995220052201522025220352204522055220652207522085220952210522115221252213522145221552216522175221852219522205222152222522235222452225522265222752228522295223052231522325223352234522355223652237522385223952240522415224252243522445224552246522475224852249522505225152252522535225452255522565225752258522595226052261522625226352264522655226652267522685226952270522715227252273522745227552276522775227852279522805228152282522835228452285522865228752288522895229052291522925229352294522955229652297522985229952300523015230252303523045230552306523075230852309523105231152312523135231452315523165231752318523195232052321523225232352324523255232652327523285232952330523315233252333523345233552336523375233852339523405234152342523435234452345523465234752348523495235052351523525235352354523555235652357523585235952360523615236252363523645236552366523675236852369523705237152372523735237452375523765237752378523795238052381523825238352384523855238652387523885238952390523915239252393523945239552396523975239852399524005240152402524035240452405524065240752408524095241052411524125241352414524155241652417524185241952420524215242252423524245242552426524275242852429524305243152432524335243452435524365243752438524395244052441524425244352444524455244652447524485244952450524515245252453524545245552456524575245852459524605246152462524635246452465524665246752468524695247052471524725247352474524755247652477524785247952480524815248252483524845248552486524875248852489524905249152492524935249452495524965249752498524995250052501525025250352504525055250652507525085250952510525115251252513525145251552516525175251852519525205252152522525235252452525525265252752528525295253052531525325253352534525355253652537525385253952540525415254252543525445254552546525475254852549525505255152552525535255452555525565255752558525595256052561525625256352564525655256652567525685256952570525715257252573525745257552576525775257852579525805258152582525835258452585525865258752588525895259052591525925259352594525955259652597525985259952600526015260252603526045260552606526075260852609526105261152612526135261452615526165261752618526195262052621526225262352624526255262652627526285262952630526315263252633526345263552636526375263852639526405264152642526435264452645526465264752648526495265052651526525265352654526555265652657526585265952660526615266252663526645266552666526675266852669526705267152672526735267452675526765267752678526795268052681526825268352684526855268652687526885268952690526915269252693526945269552696526975269852699527005270152702527035270452705527065270752708527095271052711527125271352714527155271652717527185271952720527215272252723527245272552726527275272852729527305273152732527335273452735527365273752738527395274052741527425274352744527455274652747527485274952750527515275252753527545275552756527575275852759527605276152762527635276452765527665276752768527695277052771527725277352774527755277652777527785277952780527815278252783527845278552786527875278852789527905279152792527935279452795527965279752798527995280052801528025280352804528055280652807528085280952810528115281252813528145281552816528175281852819528205282152822528235282452825528265282752828528295283052831528325283352834528355283652837528385283952840528415284252843528445284552846528475284852849528505285152852528535285452855528565285752858528595286052861528625286352864528655286652867528685286952870528715287252873528745287552876528775287852879528805288152882528835288452885528865288752888528895289052891528925289352894528955289652897528985289952900529015290252903529045290552906529075290852909529105291152912529135291452915529165291752918529195292052921529225292352924529255292652927529285292952930529315293252933529345293552936529375293852939529405294152942529435294452945529465294752948529495295052951529525295352954529555295652957529585295952960529615296252963529645296552966529675296852969529705297152972529735297452975529765297752978529795298052981529825298352984529855298652987529885298952990529915299252993529945299552996529975299852999530005300153002530035300453005530065300753008530095301053011530125301353014530155301653017530185301953020530215302253023530245302553026530275302853029530305303153032530335303453035530365303753038530395304053041530425304353044530455304653047530485304953050530515305253053530545305553056530575305853059530605306153062530635306453065530665306753068530695307053071530725307353074530755307653077530785307953080530815308253083530845308553086530875308853089530905309153092530935309453095530965309753098530995310053101531025310353104531055310653107531085310953110531115311253113531145311553116531175311853119531205312153122531235312453125531265312753128531295313053131531325313353134531355313653137531385313953140531415314253143531445314553146531475314853149531505315153152531535315453155531565315753158531595316053161531625316353164531655316653167531685316953170531715317253173531745317553176531775317853179531805318153182531835318453185531865318753188531895319053191531925319353194531955319653197531985319953200532015320253203532045320553206532075320853209532105321153212532135321453215532165321753218532195322053221532225322353224532255322653227532285322953230532315323253233532345323553236532375323853239532405324153242532435324453245532465324753248532495325053251532525325353254532555325653257532585325953260532615326253263532645326553266532675326853269532705327153272532735327453275532765327753278532795328053281532825328353284532855328653287532885328953290532915329253293532945329553296532975329853299533005330153302533035330453305533065330753308533095331053311533125331353314533155331653317533185331953320533215332253323533245332553326533275332853329533305333153332533335333453335533365333753338533395334053341533425334353344533455334653347533485334953350533515335253353533545335553356533575335853359533605336153362533635336453365533665336753368533695337053371533725337353374533755337653377533785337953380533815338253383533845338553386533875338853389533905339153392533935339453395533965339753398533995340053401534025340353404534055340653407534085340953410534115341253413534145341553416534175341853419534205342153422534235342453425534265342753428534295343053431534325343353434534355343653437534385343953440534415344253443534445344553446534475344853449534505345153452534535345453455534565345753458534595346053461534625346353464534655346653467534685346953470534715347253473534745347553476534775347853479534805348153482534835348453485534865348753488534895349053491534925349353494534955349653497534985349953500535015350253503535045350553506535075350853509535105351153512535135351453515535165351753518535195352053521535225352353524535255352653527535285352953530535315353253533535345353553536535375353853539535405354153542535435354453545535465354753548535495355053551535525355353554535555355653557535585355953560535615356253563535645356553566535675356853569535705357153572535735357453575535765357753578535795358053581535825358353584535855358653587535885358953590535915359253593535945359553596535975359853599536005360153602536035360453605536065360753608536095361053611536125361353614536155361653617536185361953620536215362253623536245362553626536275362853629536305363153632536335363453635536365363753638536395364053641536425364353644536455364653647536485364953650536515365253653536545365553656536575365853659536605366153662536635366453665536665366753668536695367053671536725367353674536755367653677536785367953680536815368253683536845368553686536875368853689536905369153692536935369453695536965369753698536995370053701537025370353704537055370653707537085370953710537115371253713537145371553716537175371853719537205372153722537235372453725537265372753728537295373053731537325373353734537355373653737537385373953740537415374253743537445374553746537475374853749537505375153752537535375453755537565375753758537595376053761537625376353764537655376653767537685376953770537715377253773537745377553776537775377853779537805378153782537835378453785537865378753788537895379053791537925379353794537955379653797537985379953800538015380253803538045380553806538075380853809538105381153812538135381453815538165381753818538195382053821538225382353824538255382653827538285382953830538315383253833538345383553836538375383853839538405384153842538435384453845538465384753848538495385053851538525385353854538555385653857538585385953860538615386253863538645386553866538675386853869538705387153872538735387453875538765387753878538795388053881538825388353884538855388653887538885388953890538915389253893538945389553896538975389853899539005390153902539035390453905539065390753908539095391053911539125391353914539155391653917539185391953920539215392253923539245392553926539275392853929539305393153932539335393453935539365393753938539395394053941539425394353944539455394653947539485394953950539515395253953539545395553956539575395853959539605396153962539635396453965539665396753968539695397053971539725397353974539755397653977539785397953980539815398253983539845398553986539875398853989539905399153992539935399453995539965399753998539995400054001540025400354004540055400654007540085400954010540115401254013540145401554016540175401854019540205402154022540235402454025540265402754028540295403054031540325403354034540355403654037540385403954040540415404254043540445404554046540475404854049540505405154052540535405454055540565405754058540595406054061540625406354064540655406654067540685406954070540715407254073540745407554076540775407854079540805408154082540835408454085540865408754088540895409054091540925409354094540955409654097540985409954100541015410254103541045410554106541075410854109541105411154112541135411454115541165411754118541195412054121541225412354124541255412654127541285412954130541315413254133541345413554136541375413854139541405414154142541435414454145541465414754148541495415054151541525415354154541555415654157541585415954160541615416254163541645416554166541675416854169541705417154172541735417454175541765417754178541795418054181541825418354184541855418654187541885418954190541915419254193541945419554196541975419854199542005420154202542035420454205542065420754208542095421054211542125421354214542155421654217542185421954220542215422254223542245422554226542275422854229542305423154232542335423454235542365423754238542395424054241542425424354244542455424654247542485424954250542515425254253542545425554256542575425854259542605426154262542635426454265
  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-9285ZTIPS3ZbzE46/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: "total_of_elements",
  601. $matrixLines: "total_of_lines",
  602. $matrixColumns: "total_of_columns",
  603. $substring: "subcadeia",
  604. $length: "comprimento",
  605. $uppercase: "caixa_alta",
  606. $lowercase: "caixa_baixa",
  607. $charAt: "char_at",
  608. $isReal: "is_real",
  609. $isInt: "is_integer",
  610. $isBool: "is_logic",
  611. $castReal: "to_real",
  612. $castInt: "to_integer",
  613. $castBool: "to_logic",
  614. $castString: "to_string",
  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: "Conversion"
  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-9285kJrTbrOnaEYd/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: "total_of_elements",
  1160. $matrixLines: "total_of_lines",
  1161. $matrixColumns: "total_of_columns",
  1162. $substring: "subcadeia",
  1163. $length: "comprimento",
  1164. $uppercase: "caixa_alta",
  1165. $lowercase: "caixa_baixa",
  1166. $charAt: "char_at",
  1167. $isReal: "is_real",
  1168. $isInt: "is_integer",
  1169. $isBool: "is_logic",
  1170. $castReal: "to_real",
  1171. $castInt: "to_integer",
  1172. $castBool: "to_logic",
  1173. $castString: "to_string",
  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: "Conversion"
  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-9285LnPrykRJlRqv/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: "total_de_elementos",
  1750. $matrixLines: "total_de_linhas",
  1751. $matrixColumns: "total_de_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: "Conversao"
  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, const_not_init, id_missing, invalid_id_format, main_missing, invalid_global_var, not_implemented, function_missing, function_missing_full, invalid_parameters_size_full, invalid_parameters_size, invalid_ref_full, invalid_ref, invalid_parameter_type_full, invalid_parameter_type, unknown_command_full, unknown_command, loop_condition_type_full, loop_condition_type, endless_loop_full, endless_loop, for_condition_type_full, for_condition_type, if_condition_type_full, if_condition_type, invalid_return_type_full, invalid_return_type, invalid_void_return_full, invalid_void_return, unexpected_break_command_full, unexpected_break_command, invalid_dimension, void_in_expression_full, void_in_expression, invalid_array_access_full, invalid_array_access, invalid_matrix_access_full, invalid_matrix_access, matrix_column_outbounds_full, matrix_column_outbounds, matrix_line_outbounds_full, matrix_line_outbounds, vector_line_outbounds_full, vector_line_outbounds, vector_not_matrix_full, vector_not_matrix, invalid_infix_op_full, invalid_infix_op, invalid_unary_op_full, invalid_unary_op, unknown_op, duplicate_function, duplicate_variable, main_parameters, symbol_not_found_full, symbol_not_found, array_dimension_not_int_full, array_dimension_not_int, array_dimension_not_positive_full, array_dimension_not_positive, incompatible_types_full, incompatible_types, incompatible_types_array_full, incompatible_types_array, invalid_case_type_full, invalid_case_type, function_no_return, invalid_array_literal_type_full, invalid_array_literal_type, invalid_array_literal_line_full, invalid_array_literal_line, invalid_array_literal_column_full, invalid_array_literal_column, exceeded_input_request, 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.","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.","exceeded_input_request":"The amount of requests exceeded the amount of available inputs"};
  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, text_none_variable, text_none_variable_instruction, text_ivprog_description, tooltip_visual, tooltip_textual, tooltip_upload, tooltip_download, tooltip_undo, tooltip_redo, tooltip_run, tooltip_evaluate, tooltip_help, tooltip_add_global, tooltip_minimize, tooltip_console, var_menu_select_var, var_menu_select_all, var_menu_select_function, expression_menu_select, math, text_t, inform_valid_name, inform_valid_content, inform_valid_expression, inform_valid_name_duplicated, inform_valid_global_duplicated, inform_valid_variable_duplicated, arrangement, conversion, $sin, $cos, $tan, $sqrt, $pow, $log, $abs, $negate, $invert, $max, $min, $substring, $length, $uppercase, $lowercase, $charAt, $numElements, $matrixLines, $matrixColumns, $isReal, $isInt, $isBool, $castReal, $castInt, $castBool, $castString, text_ivprog_version, default */
  1842. /***/ (function(module) {
  1843. module.exports = {"function":"function","btn_clear":"Clear","btn_function":"Function","btn_arithmetic_plus":"Sum","btn_arithmetic_minus":"Minus","btn_arithmetic_multiplication":"Multiplication","btn_arithmetic_division":"Division","btn_arithmetic_module":"Module","btn_break":"Break","btn_case":"Case","start":"start","void":"void","integer":"integer","real":"real","program":"program","text":"string","text_start":"text","boolean":"boolean","true":"true","false":"false","variable":"Variable","command":"Command","new_parameter":"new_parameter","new_variable":"new_variable","new_global":"new_global","new_function":"new_function","vector":"vector","text_comment_start":"Initial comment of function...","text_comment_main":"This is the main function...","text_read_var":"Reading data","text_write_var":"Writing data","text_command_read":"read","text_command_write":"write","text_comment":"Comment","text_attribution":"Attribution","text_if":"if","text_else":"else","text_break":"break","text_for":"for","text_code_while":"while","text_code_do":"do","text_command_do":"do","text_code_switch":"switch","text_code_case":"case","text_logic_expression":"Logic Expression","text_arithmetic_expression":"Relational Expression","text_iftrue":"If true then","text_receives":"receives","text_repeatNtimes":"Repeat N times","text_return":"return","text_btn_return":"Return","text_whiletrue":"While true","text_dowhiletrue":"Do while true","text_switch":"Switch","text_functioncall":"Function call","text_value":"Value","text_operator":"Operator","text_parentheses":"Parentheses","text_change":"Change","text_teacher_algorithm":"Algorithm","text_teacher_algorithm_include":"Include the following algorithm in exercise","text_teacher_test_case":"Test cases","text_teacher_config":"Settings","text_teacher_data_types":"Data types","text_teacher_commands":"Commands","text_teacher_functions":"Functions","text_teacher_create_functions":"Create new functions","text_teacher_create_movement_functions":"Move functions","text_teacher_test_case_input":"Input","text_teacher_test_case_output":"Output","text_teacher_test_case_actions":"Actions","text_teacher_test_case_add":"Add test cases","text_header_ivprog_functions":"iVProg Functions","text_menu_functions_math":"Mathematic","text_menu_functions_text":"Text","text_menu_functions_arrangement":"Arrangement","text_menu_functions_conversion":"Conversion","text_none_variable":"There is no declared variable","text_none_variable_instruction":"Create a new variable to use it","text_ivprog_description":"Interactive Visual Programming on the Internet","tooltip_visual":"Visual programming","tooltip_textual":"Textual programming","tooltip_upload":"Upload code file","tooltip_download":"Download code file","tooltip_undo":"Undo","tooltip_redo":"Redo","tooltip_run":"Run program","tooltip_evaluate":"Evaluate program","tooltip_help":"Help","tooltip_add_global":"Add global variable","tooltip_minimize":"Hidde function elements","tooltip_console":"Open/Close console","var_menu_select_var":"Select a var","var_menu_select_all":"Select","var_menu_select_function":"Select a function","expression_menu_select":"Construct any logical condition","math":"Mathematic","text_t":"Text","inform_valid_name":"Inform a valid name!","inform_valid_content":"Enter some content!","inform_valid_expression":"Construct the logical condition!","inform_valid_name_duplicated":"This name is already in use by other function.","inform_valid_global_duplicated":"A global variable with this name already exists.","inform_valid_variable_duplicated":"A local variable with this name already exists.","arrangement":"Arrangement","conversion":"Conversion","$sin":"sin","$cos":"cos","$tan":"tan","$sqrt":"sqrt","$pow":"pow","$log":"log","$abs":"abs","$negate":"negate","$invert":"invert","$max":"maximum","$min":"minimum","$substring":"substring","$length":"length","$uppercase":"uppercase","$lowercase":"lowercase","$charAt":"char_at","$numElements":"total_of_elements","$matrixLines":"total_of_lines","$matrixColumns":"total_of_columns","$isReal":"is_real","$isInt":"is_integer","$isBool":"is_logic","$castReal":"to_real","$castInt":"to_integer","$castBool":"to_logic","$castString":"to_string","text_ivprog_version":"Version"};
  1844. /***/ }),
  1845. /***/ "./i18n/es/error.json":
  1846. /*!****************************!*\
  1847. !*** ./i18n/es/error.json ***!
  1848. \****************************/
  1849. /*! exports provided: token_missing_one, token_missing_two, eos_missing, invalid_type, invalid_array_dimension, invalid_array_size, extra_lines, invalid_main_return, invalid_var_declaration, invalid_break_command, invalid_terminal, const_not_init, id_missing, invalid_id_format, main_missing, invalid_global_var, not_implemented, function_missing, function_missing_full, invalid_parameters_size_full, invalid_parameters_size, invalid_ref_full, invalid_ref, invalid_parameter_type_full, invalid_parameter_type, unknown_command_full, unknown_command, loop_condition_type_full, loop_condition_type, endless_loop_full, endless_loop, for_condition_type_full, for_condition_type, if_condition_type_full, if_condition_type, invalid_return_type_full, invalid_return_type, invalid_void_return_full, invalid_void_return, unexpected_break_command_full, unexpected_break_command, invalid_dimension, void_in_expression_full, void_in_expression, invalid_array_access_full, invalid_array_access, invalid_matrix_access_full, invalid_matrix_access, matrix_column_outbounds_full, matrix_column_outbounds, matrix_line_outbounds_full, matrix_line_outbounds, vector_line_outbounds_full, vector_line_outbounds, vector_not_matrix_full, vector_not_matrix, invalid_infix_op_full, invalid_infix_op, invalid_unary_op_full, invalid_unary_op, unknown_op, duplicate_function, duplicate_variable, main_parameters, symbol_not_found_full, symbol_not_found, array_dimension_not_int_full, array_dimension_not_int, array_dimension_not_positive_full, array_dimension_not_positive, incompatible_types_full, incompatible_types, incompatible_types_array_full, incompatible_types_array, invalid_case_type_full, invalid_case_type, function_no_return, invalid_array_literal_type_full, invalid_array_literal_type, invalid_array_literal_line_full, invalid_array_literal_line, invalid_array_literal_column_full, invalid_array_literal_column, exceeded_input_request, default */
  1850. /***/ (function(module) {
  1851. module.exports = {"token_missing_one":"Erro de sintaxe: Espera-se $0, mas encontrou-se $1 na linha:$2, coluna:$3","token_missing_two":"Erro de sintaxe: Esperava-se $0 ou $1 mas encontrou-se $2 na liha:$3, coluna: $4","eos_missing":"Falta uma nova linha ou ; na linha: $0, coluna: $1","invalid_type":"$0 na linha: $1, coluna: $2 é um tipo inválido. Os tipos válidos são: $3","invalid_array_dimension":"A dimensão inválida na linha: $0, coluna: $1. Insira um $2 ou identificador válido do mesmo tipo.","invalid_array_size":"O tamnho do vetor/matriz excede o máximo de 2 na linha $0","extra_lines":"Nenhum texto é permitido após '}' em 'programa {...}'","invalid_main_return":"A função $0 deve retornar $1 na linha $2","invalid_var_declaration":"Erro na linha $0. Variáveis só podem ser declarados no corpo principal da função e de preferência nas primeiras linhas.","invalid_break_command":"Erro na linha $0. O comando $1 não pode ser usado fora de uma estrutura de repetição ou 'escolha...caso'","invalid_terminal":"Não é possível utilizar $0 na expressão da linha: $1, coluna: $2. Tente um valor númerico, variável ou chamada de função.","const_not_init":"Erro na linha: $0, coluna: $1. Uma variável declarada como const deve ser inicializada","id_missing":"Esperava-se um identificador, mas encontrou-se $0 na linha: $1, coluna: $2","invalid_id_format":"$0 na linha: $1, coluna: $2 não é um identificador válido. O símbolo '.' não é permitido neste contexto.","main_missing":"A função principal não foi encontrada","invalid_global_var":"Erro crítico: Chamada inválida da função initGlobal fora do contexto BASE","not_implemented":"Erro interno crítico: A função definida pelo sistema $0 não foi implementada.","function_missing":"A função $0 não foi encontrada","function_missing_full":"A função $0 na linha: $1, coluna: $2 não foi encontrada","invalid_parameters_size_full":"Erro na linha $0: a quantidade de parâmetros fornecidos à função $1 está incorreta. Esperava-se $2, encontrou-se $3.","invalid_parameters_size":"A quantidade de parâmetros fornecidos à função $0 está incorreta. Esperava-se $1, encontrou-se $2","invalid_ref_full":"A expressão $0 fornecida como parâmetro para a função $1 na linha $2 não é válida para esta função. Use uma variável ou posição de vetor.","invalid_ref":"A expressão $0 fornecida como parâmetro para a função $1 não é válida para esta função. Use uma variável ou posição de vetor.","invalid_parameter_type_full":"A expressão $0 fornecida como parâmetro para a função $1 na linha $2 não é compatível com o tipo esperado.","invalid_parameter_type":"A expressão $0 fornecida como parâmetro para a função $1 não é compatível com o tipo esperado.","unknown_command_full":"Erro interno crítico: comando desconhecido encontrado na linha $0","unknown_command":"Erro interno crítico: comando desconhecido encontrado!","loop_condition_type_full":"Erro na linha: $0, coluna $1: a condição 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.","exceeded_input_request":"The amount of requests exceeded the amount of available inputs"};
  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, text_none_variable, text_none_variable_instruction, text_ivprog_description, tooltip_visual, tooltip_textual, tooltip_upload, tooltip_download, tooltip_undo, tooltip_redo, tooltip_run, tooltip_evaluate, tooltip_help, tooltip_add_global, tooltip_minimize, tooltip_console, var_menu_select_var, var_menu_select_all, var_menu_select_function, expression_menu_select, $sin, math, arrangement, conversion, inform_valid_name, inform_valid_content, inform_valid_expression, inform_valid_name_duplicated, inform_valid_global_duplicated, inform_valid_variable_duplicated, text_t, $cos, $tan, $sqrt, $pow, $log, $abs, $negate, $invert, $max, $min, $substring, $length, $uppercase, $lowercase, $charAt, $numElements, $matrixLines, $matrixColumns, $isReal, $isInt, $isBool, $castReal, $castInt, $castBool, $castString, text_ivprog_version, default */
  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":"Relational 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","text_none_variable":"There is no declared variable","text_none_variable_instruction":"Create a new variable to use it","text_ivprog_description":"Interactive Visual Programming on the Internet","tooltip_visual":"Visual programming","tooltip_textual":"Textual programming","tooltip_upload":"Upload code file","tooltip_download":"Download code file","tooltip_undo":"Undo","tooltip_redo":"Redo","tooltip_run":"Run program","tooltip_evaluate":"Evaluate program","tooltip_help":"Help","tooltip_add_global":"Add global variable","tooltip_minimize":"Hidde function elements","tooltip_console":"Open/Close console","var_menu_select_var":"Select a var","var_menu_select_all":"Select","var_menu_select_function":"Select a function","expression_menu_select":"Construct any logical condition","$sin":"sin","math":"Mathematic","arrangement":"Arrangement","conversion":"Conversion","inform_valid_name":"Inform a valid name!","inform_valid_content":"Enter some content!","inform_valid_expression":"Construct the logical condition!","inform_valid_name_duplicated":"This name is already in use by other function.","inform_valid_global_duplicated":"A global variable with this name already exists.","inform_valid_variable_duplicated":"A local variable with this name already exists.","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","$numElements":"total_of_elements","$matrixLines":"total_of_lines","$matrixColumns":"total_of_columns","$isReal":"is_real","$isInt":"is_integer","$isBool":"is_logic","$castReal":"to_real","$castInt":"to_integer","$castBool":"to_logic","$castString":"to_string","text_ivprog_version":"Version"};
  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, exceeded_input_request, 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.","exceeded_input_request":"A quantidade de leituras requisitadas execedeu a quantidade de entradas disponíveis."};
  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, text_none_variable, text_none_variable_instruction, text_ivprog_description, tooltip_visual, tooltip_textual, tooltip_upload, tooltip_download, tooltip_undo, tooltip_redo, tooltip_run, tooltip_evaluate, tooltip_help, tooltip_add_global, tooltip_minimize, tooltip_console, var_menu_select_var, var_menu_select_all, var_menu_select_function, expression_menu_select, $sin, math, text_t, inform_valid_name, inform_valid_content, inform_valid_expression, inform_valid_name_duplicated, inform_valid_global_duplicated, inform_valid_variable_duplicated, arrangement, conversion, $cos, $tan, $sqrt, $pow, $log, $abs, $negate, $invert, $max, $min, $substring, $length, $uppercase, $lowercase, $charAt, $numElements, $matrixLines, $matrixColumns, $isReal, $isInt, $isBool, $castReal, $castInt, $castBool, $castString, text_ivprog_version, default */
  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 Relacional","text_iftrue":"Se verdadeiro então","text_repeatNtimes":"Repita N vezes","text_receives":"recebe","text_whiletrue":"Enquanto verdadeiro","text_dowhiletrue":"Faça enquanto verdadeiro","text_switch":"Escolha","text_functioncall":"Chamada de função","text_value":"Valor","text_operator":"Operador","text_parentheses":"Parênteses","text_change":"Alterar","text_teacher_algorithm":"Algoritmo","text_teacher_algorithm_include":"Incluir o algoritmo abaixo no exercício","text_teacher_test_case":"Casos de teste","text_teacher_config":"Configurações","text_teacher_data_types":"Tipos de dados","text_teacher_commands":"Comandos","text_teacher_functions":"Funções","text_teacher_create_functions":"Criar novas funções","text_teacher_create_movement_functions":"Movimentar funções","text_teacher_test_case_input":"Entrada","text_teacher_test_case_output":"Saída","text_teacher_test_case_actions":"Ações","text_teacher_test_case_add":"Adicionar caso de teste","text_header_ivprog_functions":"Funções do iVProg","text_menu_functions_math":"Matemática","text_menu_functions_text":"Texto","text_menu_functions_arrangement":"Arranjo","text_menu_functions_conversion":"Conversão","text_none_variable":"Nenhuma variável declarada","text_none_variable_instruction":"Antes de utilizar uma variável, é necessário criá-la","text_ivprog_description":"Programação Visual interativa na Internet","tooltip_visual":"Programação visual","tooltip_textual":"Programação textual","tooltip_upload":"Upload de código fonte","tooltip_download":"Download do código fonte","tooltip_undo":"Desfazer","tooltip_redo":"Refazer","tooltip_run":"Executar o programa","tooltip_evaluate":"Avaliar o programa","tooltip_help":"Ajuda","tooltip_add_global":"Adicionar variável global","tooltip_minimize":"Ocultar os elementos da função","tooltip_console":"Abrir/fechar o terminal","var_menu_select_var":"Selecione uma variável","var_menu_select_all":"Selecione","var_menu_select_function":"Selecione uma função","expression_menu_select":"Construir uma expressão lógica","$sin":"seno","math":"Matematica","text_t":"Texto","inform_valid_name":"Informe um nome válido!","inform_valid_content":"Informe o conteúdo!","inform_valid_expression":"Construa uma expressão lógica!","inform_valid_name_duplicated":"Este nome já está em uso por outra função!","inform_valid_global_duplicated":"Já existe uma variável global com o nome informado.","inform_valid_variable_duplicated":"Já existe uma variável local com o nome informado.","arrangement":"Arranjo","conversion":"Conversao","$cos":"cosseno","$tan":"tangente","$sqrt":"raiz_quadrada","$pow":"potencia","$log":"logaritmo","$abs":"modulo","$negate":"trocar_sinal","$invert":"inverter_valor","$max":"maximo","$min":"minimo","$substring":"subcadeia","$length":"comprimento","$uppercase":"caixa_alta","$lowercase":"caixa_baixa","$charAt":"texto_na_posicao","$numElements":"total_de_elementos","$matrixLines":"total_de_linhas","$matrixColumns":"total_de_colunas","$isReal":"e_real","$isInt":"e_inteiro","$isBool":"e_logico","$castReal":"como_real","$castInt":"como_inteiro","$castBool":"como_logico","$castString":"como_cadeia","text_ivprog_version":"Versão"};
  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(curr);
  3125. }, Promise.resolve(0));
  3126. return testResult.then(function (total) {
  3127. return Promise.resolve(total / _this.testCases.length);
  3128. }).catch(function (err) {
  3129. _this.domConsole.err("Erro durante a execução do programa"); // try and show error messages through domconsole
  3130. _this.domConsole.err(err.message);
  3131. return Promise.resolve(0);
  3132. });
  3133. } catch (error) {
  3134. this.domConsole.err("Erro durante a execução do programa"); // try and show error messages through domconsole
  3135. this.domConsole.err(error.message);
  3136. return Promise.resolve(0);
  3137. }
  3138. }
  3139. }, {
  3140. key: "evaluateTestCase",
  3141. value: function evaluateTestCase(prog, inputList, outputList, name, accumulator) {
  3142. var _this2 = this;
  3143. var outerThis = this;
  3144. var input = new _inputTest.InputTest(inputList);
  3145. var output = new _outputTest.OutputTest();
  3146. prog.registerInput(input);
  3147. prog.registerOutput(output);
  3148. var startTime = Date.now();
  3149. return prog.interpretAST().then(function (_) {
  3150. var millis = Date.now() - startTime;
  3151. if (input.inputList.length !== input.index) {
  3152. outerThis.domConsole.err("Caso de teste " + (name + 1) + ": Falhou, ainda restam entradas!");
  3153. outerThis.domConsole.info("Levou " + millis + "ms");
  3154. return Promise.resolve(accumulator + 1 * (input.index / inputList.length));
  3155. } else if (output.list.length < outputList.length) {
  3156. outerThis.domConsole.err("Caso de teste " + (name + 1) + ": Falhou <" + inputList.join(", ") + ";" + outputList.join(", ") + ";" + output.list.join(", ") + ">");
  3157. outerThis.domConsole.info("Levou " + millis + "ms");
  3158. return Promise.resolve(accumulator + 1 * (output.list.length / outputList.length));
  3159. } else if (output.list.length > outputList.length) {
  3160. outerThis.domConsole.err("Caso de teste " + (name + 1) + ": Falhou <" + inputList.join(", ") + ";" + outputList.join(", ") + ";" + output.list.join(", ") + ">");
  3161. outerThis.domConsole.info("Levou " + millis + "ms");
  3162. return Promise.resolve(accumulator + 1 * (outputList.length / output.list.length));
  3163. } else {
  3164. var isOk = outerThis.checkOutput(output.list, outputList);
  3165. if (!isOk) {
  3166. outerThis.domConsole.err("Caso de teste " + (name + 1) + ": Falhou <" + inputList.join(", ") + ";" + outputList.join(", ") + ";" + output.list.join(", ") + ">");
  3167. outerThis.domConsole.info("Levou " + millis + "ms");
  3168. return Promise.resolve(accumulator);
  3169. } else {
  3170. outerThis.domConsole.info("Caso de teste " + (name + 1) + ": OK!");
  3171. outerThis.domConsole.info("Levou " + millis + "ms");
  3172. return Promise.resolve(accumulator + 1);
  3173. }
  3174. }
  3175. }).catch(function (error) {
  3176. _this2.domConsole.err("Execu\xE7\xE3o do caso de teste " + (name + 1) + " falhou!"); // try and show error messages through domconsole
  3177. _this2.domConsole.err(error.message);
  3178. return Promise.resolve(accumulator);
  3179. });
  3180. }
  3181. }, {
  3182. key: "partialEvaluateTestCase",
  3183. value: function partialEvaluateTestCase(prog, inputList, outputList, name) {
  3184. return this.evaluateTestCase.bind(this, prog, inputList, outputList, name);
  3185. }
  3186. }, {
  3187. key: "checkOutput",
  3188. value: function checkOutput(aList, bList) {
  3189. for (var i = 0; i < aList.length; i++) {
  3190. var outValue = aList[i];
  3191. if (outValue != bList[i]) {
  3192. return false;
  3193. }
  3194. }
  3195. return true;
  3196. }
  3197. }]);
  3198. return IVProgAssessment;
  3199. }();
  3200. /***/ }),
  3201. /***/ "./js/ast/commands/arrayAssign.js":
  3202. /*!****************************************!*\
  3203. !*** ./js/ast/commands/arrayAssign.js ***!
  3204. \****************************************/
  3205. /*! no static exports found */
  3206. /***/ (function(module, exports, __webpack_require__) {
  3207. "use strict";
  3208. Object.defineProperty(exports, "__esModule", {
  3209. value: true
  3210. });
  3211. exports.ArrayIndexAssign = undefined;
  3212. var _assign = __webpack_require__(/*! ./assign */ "./js/ast/commands/assign.js");
  3213. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3214. 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; }
  3215. 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; }
  3216. var ArrayIndexAssign = exports.ArrayIndexAssign = function (_Assign) {
  3217. _inherits(ArrayIndexAssign, _Assign);
  3218. function ArrayIndexAssign(id, lineExpression, columnExpression, expression) {
  3219. _classCallCheck(this, ArrayIndexAssign);
  3220. var _this = _possibleConstructorReturn(this, (ArrayIndexAssign.__proto__ || Object.getPrototypeOf(ArrayIndexAssign)).call(this, id, expression));
  3221. _this.line = lineExpression;
  3222. _this.column = columnExpression;
  3223. return _this;
  3224. }
  3225. return ArrayIndexAssign;
  3226. }(_assign.Assign);
  3227. /***/ }),
  3228. /***/ "./js/ast/commands/arrayDeclaration.js":
  3229. /*!*********************************************!*\
  3230. !*** ./js/ast/commands/arrayDeclaration.js ***!
  3231. \*********************************************/
  3232. /*! no static exports found */
  3233. /***/ (function(module, exports, __webpack_require__) {
  3234. "use strict";
  3235. Object.defineProperty(exports, "__esModule", {
  3236. value: true
  3237. });
  3238. exports.ArrayDeclaration = undefined;
  3239. var _declaration = __webpack_require__(/*! ./declaration */ "./js/ast/commands/declaration.js");
  3240. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3241. 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; }
  3242. 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; }
  3243. var ArrayDeclaration = exports.ArrayDeclaration = function (_Declaration) {
  3244. _inherits(ArrayDeclaration, _Declaration);
  3245. function ArrayDeclaration(id, type, lines, columns, initial, isConst) {
  3246. _classCallCheck(this, ArrayDeclaration);
  3247. var _this = _possibleConstructorReturn(this, (ArrayDeclaration.__proto__ || Object.getPrototypeOf(ArrayDeclaration)).call(this, id, type, initial, isConst));
  3248. _this.lines = lines;
  3249. _this.columns = columns;
  3250. return _this;
  3251. }
  3252. return ArrayDeclaration;
  3253. }(_declaration.Declaration);
  3254. /***/ }),
  3255. /***/ "./js/ast/commands/assign.js":
  3256. /*!***********************************!*\
  3257. !*** ./js/ast/commands/assign.js ***!
  3258. \***********************************/
  3259. /*! no static exports found */
  3260. /***/ (function(module, exports, __webpack_require__) {
  3261. "use strict";
  3262. Object.defineProperty(exports, "__esModule", {
  3263. value: true
  3264. });
  3265. exports.Assign = undefined;
  3266. var _command = __webpack_require__(/*! ./command */ "./js/ast/commands/command.js");
  3267. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3268. 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; }
  3269. 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; }
  3270. var Assign = exports.Assign = function (_Command) {
  3271. _inherits(Assign, _Command);
  3272. function Assign(id, expression) {
  3273. _classCallCheck(this, Assign);
  3274. var _this = _possibleConstructorReturn(this, (Assign.__proto__ || Object.getPrototypeOf(Assign)).call(this));
  3275. _this.id = id;
  3276. _this.expression = expression;
  3277. return _this;
  3278. }
  3279. return Assign;
  3280. }(_command.Command);
  3281. /***/ }),
  3282. /***/ "./js/ast/commands/break.js":
  3283. /*!**********************************!*\
  3284. !*** ./js/ast/commands/break.js ***!
  3285. \**********************************/
  3286. /*! no static exports found */
  3287. /***/ (function(module, exports, __webpack_require__) {
  3288. "use strict";
  3289. Object.defineProperty(exports, "__esModule", {
  3290. value: true
  3291. });
  3292. exports.Break = undefined;
  3293. var _command = __webpack_require__(/*! ./command */ "./js/ast/commands/command.js");
  3294. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3295. 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; }
  3296. 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; }
  3297. var Break = exports.Break = function (_Command) {
  3298. _inherits(Break, _Command);
  3299. function Break() {
  3300. _classCallCheck(this, Break);
  3301. return _possibleConstructorReturn(this, (Break.__proto__ || Object.getPrototypeOf(Break)).call(this));
  3302. }
  3303. return Break;
  3304. }(_command.Command);
  3305. /***/ }),
  3306. /***/ "./js/ast/commands/case.js":
  3307. /*!*********************************!*\
  3308. !*** ./js/ast/commands/case.js ***!
  3309. \*********************************/
  3310. /*! no static exports found */
  3311. /***/ (function(module, exports, __webpack_require__) {
  3312. "use strict";
  3313. Object.defineProperty(exports, "__esModule", {
  3314. value: true
  3315. });
  3316. exports.Case = undefined;
  3317. 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; }; }();
  3318. var _command = __webpack_require__(/*! ./command */ "./js/ast/commands/command.js");
  3319. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3320. 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; }
  3321. 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; }
  3322. var Case = exports.Case = function (_Command) {
  3323. _inherits(Case, _Command);
  3324. function Case(expression) {
  3325. _classCallCheck(this, Case);
  3326. var _this = _possibleConstructorReturn(this, (Case.__proto__ || Object.getPrototypeOf(Case)).call(this));
  3327. _this.expression = expression;
  3328. _this.commands = [];
  3329. return _this;
  3330. }
  3331. _createClass(Case, [{
  3332. key: 'setCommands',
  3333. value: function setCommands(commands) {
  3334. this.commands = commands;
  3335. }
  3336. }, {
  3337. key: 'isDefault',
  3338. get: function get() {
  3339. return this.expression === null;
  3340. }
  3341. }]);
  3342. return Case;
  3343. }(_command.Command);
  3344. /***/ }),
  3345. /***/ "./js/ast/commands/command.js":
  3346. /*!************************************!*\
  3347. !*** ./js/ast/commands/command.js ***!
  3348. \************************************/
  3349. /*! no static exports found */
  3350. /***/ (function(module, exports, __webpack_require__) {
  3351. "use strict";
  3352. Object.defineProperty(exports, "__esModule", {
  3353. value: true
  3354. });
  3355. 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; }; }();
  3356. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3357. var Command = exports.Command = function () {
  3358. function Command() {
  3359. _classCallCheck(this, Command);
  3360. this._sourceInfo = null;
  3361. }
  3362. _createClass(Command, [{
  3363. key: "sourceInfo",
  3364. set: function set(sourceInfo) {
  3365. this._sourceInfo = sourceInfo;
  3366. },
  3367. get: function get() {
  3368. return this._sourceInfo;
  3369. }
  3370. }]);
  3371. return Command;
  3372. }();
  3373. /***/ }),
  3374. /***/ "./js/ast/commands/commandBlock.js":
  3375. /*!*****************************************!*\
  3376. !*** ./js/ast/commands/commandBlock.js ***!
  3377. \*****************************************/
  3378. /*! no static exports found */
  3379. /***/ (function(module, exports, __webpack_require__) {
  3380. "use strict";
  3381. Object.defineProperty(exports, "__esModule", {
  3382. value: true
  3383. });
  3384. 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; }; }();
  3385. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3386. var CommandBlock = exports.CommandBlock = function () {
  3387. function CommandBlock(variables, commands) {
  3388. _classCallCheck(this, CommandBlock);
  3389. this.variables = variables;
  3390. this.commands = commands;
  3391. this._sourceInfo = null;
  3392. }
  3393. _createClass(CommandBlock, [{
  3394. key: "sourceInfo",
  3395. set: function set(sourceInfo) {
  3396. this._sourceInfo = sourceInfo;
  3397. },
  3398. get: function get() {
  3399. return this._sourceInfo;
  3400. }
  3401. }]);
  3402. return CommandBlock;
  3403. }();
  3404. /***/ }),
  3405. /***/ "./js/ast/commands/declaration.js":
  3406. /*!****************************************!*\
  3407. !*** ./js/ast/commands/declaration.js ***!
  3408. \****************************************/
  3409. /*! no static exports found */
  3410. /***/ (function(module, exports, __webpack_require__) {
  3411. "use strict";
  3412. Object.defineProperty(exports, "__esModule", {
  3413. value: true
  3414. });
  3415. exports.Declaration = undefined;
  3416. var _command = __webpack_require__(/*! ./command */ "./js/ast/commands/command.js");
  3417. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3418. 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; }
  3419. 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; }
  3420. var Declaration = exports.Declaration = function (_Command) {
  3421. _inherits(Declaration, _Command);
  3422. function Declaration(id, type, initial, isConst) {
  3423. _classCallCheck(this, Declaration);
  3424. var _this = _possibleConstructorReturn(this, (Declaration.__proto__ || Object.getPrototypeOf(Declaration)).call(this));
  3425. _this.id = id;
  3426. _this.type = type;
  3427. _this.initial = initial;
  3428. _this.isConst = isConst;
  3429. return _this;
  3430. }
  3431. return Declaration;
  3432. }(_command.Command);
  3433. /***/ }),
  3434. /***/ "./js/ast/commands/doWhile.js":
  3435. /*!************************************!*\
  3436. !*** ./js/ast/commands/doWhile.js ***!
  3437. \************************************/
  3438. /*! no static exports found */
  3439. /***/ (function(module, exports, __webpack_require__) {
  3440. "use strict";
  3441. Object.defineProperty(exports, "__esModule", {
  3442. value: true
  3443. });
  3444. exports.DoWhile = undefined;
  3445. 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; }; }();
  3446. var _while = __webpack_require__(/*! ./while */ "./js/ast/commands/while.js");
  3447. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3448. 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; }
  3449. 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; }
  3450. var DoWhile = exports.DoWhile = function (_While) {
  3451. _inherits(DoWhile, _While);
  3452. function DoWhile(condition, commandBlock) {
  3453. _classCallCheck(this, DoWhile);
  3454. return _possibleConstructorReturn(this, (DoWhile.__proto__ || Object.getPrototypeOf(DoWhile)).call(this, condition, commandBlock));
  3455. }
  3456. _createClass(DoWhile, [{
  3457. key: 'testFirst',
  3458. get: function get() {
  3459. return false;
  3460. }
  3461. }]);
  3462. return DoWhile;
  3463. }(_while.While);
  3464. /***/ }),
  3465. /***/ "./js/ast/commands/for.js":
  3466. /*!********************************!*\
  3467. !*** ./js/ast/commands/for.js ***!
  3468. \********************************/
  3469. /*! no static exports found */
  3470. /***/ (function(module, exports, __webpack_require__) {
  3471. "use strict";
  3472. Object.defineProperty(exports, "__esModule", {
  3473. value: true
  3474. });
  3475. exports.For = undefined;
  3476. 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; }; }();
  3477. var _command = __webpack_require__(/*! ./command */ "./js/ast/commands/command.js");
  3478. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3479. 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; }
  3480. 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; }
  3481. var For = exports.For = function (_Command) {
  3482. _inherits(For, _Command);
  3483. function For(assignment, condition, increment, commandBlock) {
  3484. _classCallCheck(this, For);
  3485. var _this = _possibleConstructorReturn(this, (For.__proto__ || Object.getPrototypeOf(For)).call(this));
  3486. _this.assignment = assignment;
  3487. _this.condition = condition;
  3488. _this.increment = increment;
  3489. _this.commandBlock = commandBlock;
  3490. return _this;
  3491. }
  3492. _createClass(For, [{
  3493. key: 'commands',
  3494. get: function get() {
  3495. return this.commandBlock.commands;
  3496. }
  3497. }]);
  3498. return For;
  3499. }(_command.Command);
  3500. /***/ }),
  3501. /***/ "./js/ast/commands/formalParameter.js":
  3502. /*!********************************************!*\
  3503. !*** ./js/ast/commands/formalParameter.js ***!
  3504. \********************************************/
  3505. /*! no static exports found */
  3506. /***/ (function(module, exports, __webpack_require__) {
  3507. "use strict";
  3508. Object.defineProperty(exports, "__esModule", {
  3509. value: true
  3510. });
  3511. 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; }; }();
  3512. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3513. var FormalParameter = exports.FormalParameter = function () {
  3514. function FormalParameter(type, id) {
  3515. var byRef = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  3516. _classCallCheck(this, FormalParameter);
  3517. this.type = type;
  3518. this.id = id;
  3519. this.byRef = byRef;
  3520. this._sourceInfo = null;
  3521. }
  3522. _createClass(FormalParameter, [{
  3523. key: "sourceInfo",
  3524. set: function set(sourceInfo) {
  3525. this._sourceInfo = sourceInfo;
  3526. },
  3527. get: function get() {
  3528. return this._sourceInfo;
  3529. }
  3530. }]);
  3531. return FormalParameter;
  3532. }();
  3533. /***/ }),
  3534. /***/ "./js/ast/commands/function.js":
  3535. /*!*************************************!*\
  3536. !*** ./js/ast/commands/function.js ***!
  3537. \*************************************/
  3538. /*! no static exports found */
  3539. /***/ (function(module, exports, __webpack_require__) {
  3540. "use strict";
  3541. Object.defineProperty(exports, "__esModule", {
  3542. value: true
  3543. });
  3544. exports.Function = undefined;
  3545. 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; }; }();
  3546. var _types = __webpack_require__(/*! ./../../typeSystem/types */ "./js/typeSystem/types.js");
  3547. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3548. var Function = exports.Function = function () {
  3549. function Function(name, returnType, formalParameters, commandBlock) {
  3550. _classCallCheck(this, Function);
  3551. this.name = name;
  3552. this.returnType = returnType;
  3553. this.formalParameters = formalParameters;
  3554. this.commandBlock = commandBlock;
  3555. this._sourceInfo = null;
  3556. }
  3557. _createClass(Function, [{
  3558. key: 'isMain',
  3559. get: function get() {
  3560. return this.name === null && this.returnType.isCompatible(_types.Types.VOID);
  3561. }
  3562. }, {
  3563. key: 'commands',
  3564. get: function get() {
  3565. return this.commandBlock.commands;
  3566. }
  3567. }, {
  3568. key: 'variablesDeclarations',
  3569. get: function get() {
  3570. return this.commandBlock.variables;
  3571. }
  3572. }, {
  3573. key: 'sourceInfo',
  3574. set: function set(sourceInfo) {
  3575. this._sourceInfo = sourceInfo;
  3576. },
  3577. get: function get() {
  3578. return this._sourceInfo;
  3579. }
  3580. }]);
  3581. return Function;
  3582. }();
  3583. /***/ }),
  3584. /***/ "./js/ast/commands/ifThenElse.js":
  3585. /*!***************************************!*\
  3586. !*** ./js/ast/commands/ifThenElse.js ***!
  3587. \***************************************/
  3588. /*! no static exports found */
  3589. /***/ (function(module, exports, __webpack_require__) {
  3590. "use strict";
  3591. Object.defineProperty(exports, "__esModule", {
  3592. value: true
  3593. });
  3594. exports.IfThenElse = undefined;
  3595. var _command = __webpack_require__(/*! ./command */ "./js/ast/commands/command.js");
  3596. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3597. 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; }
  3598. 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; }
  3599. var IfThenElse = exports.IfThenElse = function (_Command) {
  3600. _inherits(IfThenElse, _Command);
  3601. function IfThenElse(condition, ifTrue, ifFalse) {
  3602. _classCallCheck(this, IfThenElse);
  3603. var _this = _possibleConstructorReturn(this, (IfThenElse.__proto__ || Object.getPrototypeOf(IfThenElse)).call(this));
  3604. _this.condition = condition;
  3605. _this.ifTrue = ifTrue;
  3606. _this.ifFalse = ifFalse;
  3607. return _this;
  3608. }
  3609. return IfThenElse;
  3610. }(_command.Command);
  3611. /***/ }),
  3612. /***/ "./js/ast/commands/index.js":
  3613. /*!**********************************!*\
  3614. !*** ./js/ast/commands/index.js ***!
  3615. \**********************************/
  3616. /*! no static exports found */
  3617. /***/ (function(module, exports, __webpack_require__) {
  3618. "use strict";
  3619. Object.defineProperty(exports, "__esModule", {
  3620. value: true
  3621. });
  3622. 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;
  3623. var _break = __webpack_require__(/*! ./break */ "./js/ast/commands/break.js");
  3624. var _return = __webpack_require__(/*! ./return */ "./js/ast/commands/return.js");
  3625. var _assign = __webpack_require__(/*! ./assign */ "./js/ast/commands/assign.js");
  3626. var _arrayAssign = __webpack_require__(/*! ./arrayAssign */ "./js/ast/commands/arrayAssign.js");
  3627. var _declaration = __webpack_require__(/*! ./declaration */ "./js/ast/commands/declaration.js");
  3628. var _arrayDeclaration = __webpack_require__(/*! ./arrayDeclaration */ "./js/ast/commands/arrayDeclaration.js");
  3629. var _while = __webpack_require__(/*! ./while */ "./js/ast/commands/while.js");
  3630. var _for = __webpack_require__(/*! ./for */ "./js/ast/commands/for.js");
  3631. var _function = __webpack_require__(/*! ./function */ "./js/ast/commands/function.js");
  3632. var _ifThenElse = __webpack_require__(/*! ./ifThenElse */ "./js/ast/commands/ifThenElse.js");
  3633. var _commandBlock = __webpack_require__(/*! ./commandBlock */ "./js/ast/commands/commandBlock.js");
  3634. var _doWhile = __webpack_require__(/*! ./doWhile */ "./js/ast/commands/doWhile.js");
  3635. var _switch = __webpack_require__(/*! ./switch */ "./js/ast/commands/switch.js");
  3636. var _case = __webpack_require__(/*! ./case */ "./js/ast/commands/case.js");
  3637. var _sysCall = __webpack_require__(/*! ./sysCall */ "./js/ast/commands/sysCall.js");
  3638. var _formalParameter = __webpack_require__(/*! ./formalParameter */ "./js/ast/commands/formalParameter.js");
  3639. var _functionCall = __webpack_require__(/*! ./../expressions/functionCall */ "./js/ast/expressions/functionCall.js");
  3640. //Proxy to expression since they do exatcly the same thing
  3641. exports.Break = _break.Break;
  3642. exports.Return = _return.Return;
  3643. exports.Assign = _assign.Assign;
  3644. exports.ArrayIndexAssign = _arrayAssign.ArrayIndexAssign;
  3645. exports.Declaration = _declaration.Declaration;
  3646. exports.ArrayDeclaration = _arrayDeclaration.ArrayDeclaration;
  3647. exports.While = _while.While;
  3648. exports.For = _for.For;
  3649. exports.Function = _function.Function;
  3650. exports.IfThenElse = _ifThenElse.IfThenElse;
  3651. exports.CommandBlock = _commandBlock.CommandBlock;
  3652. exports.DoWhile = _doWhile.DoWhile;
  3653. exports.Switch = _switch.Switch;
  3654. exports.Case = _case.Case;
  3655. exports.SysCall = _sysCall.SysCall;
  3656. exports.FormalParameter = _formalParameter.FormalParameter;
  3657. exports.FunctionCall = _functionCall.FunctionCall;
  3658. /***/ }),
  3659. /***/ "./js/ast/commands/return.js":
  3660. /*!***********************************!*\
  3661. !*** ./js/ast/commands/return.js ***!
  3662. \***********************************/
  3663. /*! no static exports found */
  3664. /***/ (function(module, exports, __webpack_require__) {
  3665. "use strict";
  3666. Object.defineProperty(exports, "__esModule", {
  3667. value: true
  3668. });
  3669. exports.Return = undefined;
  3670. var _command = __webpack_require__(/*! ./command */ "./js/ast/commands/command.js");
  3671. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3672. 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; }
  3673. 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; }
  3674. var Return = exports.Return = function (_Command) {
  3675. _inherits(Return, _Command);
  3676. function Return(expression) {
  3677. _classCallCheck(this, Return);
  3678. var _this = _possibleConstructorReturn(this, (Return.__proto__ || Object.getPrototypeOf(Return)).call(this));
  3679. _this.expression = expression;
  3680. return _this;
  3681. }
  3682. return Return;
  3683. }(_command.Command);
  3684. /***/ }),
  3685. /***/ "./js/ast/commands/switch.js":
  3686. /*!***********************************!*\
  3687. !*** ./js/ast/commands/switch.js ***!
  3688. \***********************************/
  3689. /*! no static exports found */
  3690. /***/ (function(module, exports, __webpack_require__) {
  3691. "use strict";
  3692. Object.defineProperty(exports, "__esModule", {
  3693. value: true
  3694. });
  3695. exports.Switch = undefined;
  3696. var _command = __webpack_require__(/*! ./command */ "./js/ast/commands/command.js");
  3697. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3698. 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; }
  3699. 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; }
  3700. var Switch = exports.Switch = function (_Command) {
  3701. _inherits(Switch, _Command);
  3702. function Switch(expression, cases) {
  3703. _classCallCheck(this, Switch);
  3704. var _this = _possibleConstructorReturn(this, (Switch.__proto__ || Object.getPrototypeOf(Switch)).call(this));
  3705. _this.expression = expression;
  3706. _this.cases = cases;
  3707. return _this;
  3708. }
  3709. return Switch;
  3710. }(_command.Command);
  3711. /***/ }),
  3712. /***/ "./js/ast/commands/sysCall.js":
  3713. /*!************************************!*\
  3714. !*** ./js/ast/commands/sysCall.js ***!
  3715. \************************************/
  3716. /*! no static exports found */
  3717. /***/ (function(module, exports, __webpack_require__) {
  3718. "use strict";
  3719. Object.defineProperty(exports, "__esModule", {
  3720. value: true
  3721. });
  3722. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3723. /**
  3724. * This class represents all the language defined functions.
  3725. * The language processor uses the id provided here to properly execute the desired function.
  3726. * The function is actually implemented inside the language processor.
  3727. * All the functions can be found at: js/processor/definedFunctions.js
  3728. */
  3729. var SysCall = exports.SysCall = function SysCall(langFunc) {
  3730. _classCallCheck(this, SysCall);
  3731. this.langFunc = langFunc;
  3732. };
  3733. /***/ }),
  3734. /***/ "./js/ast/commands/while.js":
  3735. /*!**********************************!*\
  3736. !*** ./js/ast/commands/while.js ***!
  3737. \**********************************/
  3738. /*! no static exports found */
  3739. /***/ (function(module, exports, __webpack_require__) {
  3740. "use strict";
  3741. Object.defineProperty(exports, "__esModule", {
  3742. value: true
  3743. });
  3744. exports.While = undefined;
  3745. 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; }; }();
  3746. var _command = __webpack_require__(/*! ./command */ "./js/ast/commands/command.js");
  3747. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3748. 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; }
  3749. 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; }
  3750. var While = exports.While = function (_Command) {
  3751. _inherits(While, _Command);
  3752. function While(expression, commandBlock) {
  3753. _classCallCheck(this, While);
  3754. var _this = _possibleConstructorReturn(this, (While.__proto__ || Object.getPrototypeOf(While)).call(this));
  3755. _this.expression = expression;
  3756. _this.commandBlock = commandBlock;
  3757. return _this;
  3758. }
  3759. _createClass(While, [{
  3760. key: 'commands',
  3761. get: function get() {
  3762. return this.commandBlock.commands;
  3763. }
  3764. }, {
  3765. key: 'testFirst',
  3766. get: function get() {
  3767. return true;
  3768. }
  3769. }]);
  3770. return While;
  3771. }(_command.Command);
  3772. /***/ }),
  3773. /***/ "./js/ast/error/syntaxError.js":
  3774. /*!*************************************!*\
  3775. !*** ./js/ast/error/syntaxError.js ***!
  3776. \*************************************/
  3777. /*! no static exports found */
  3778. /***/ (function(module, exports, __webpack_require__) {
  3779. "use strict";
  3780. Object.defineProperty(exports, "__esModule", {
  3781. value: true
  3782. });
  3783. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3784. 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; }
  3785. 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; }
  3786. var SyntaxError = exports.SyntaxError = function (_Error) {
  3787. _inherits(SyntaxError, _Error);
  3788. function SyntaxError() {
  3789. var _ref;
  3790. _classCallCheck(this, SyntaxError);
  3791. for (var _len = arguments.length, msg = Array(_len), _key = 0; _key < _len; _key++) {
  3792. msg[_key] = arguments[_key];
  3793. }
  3794. var _this = _possibleConstructorReturn(this, (_ref = SyntaxError.__proto__ || Object.getPrototypeOf(SyntaxError)).call.apply(_ref, [this].concat(msg)));
  3795. if (Error.captureStackTrace) Error.captureStackTrace(_this, SyntaxError);
  3796. return _this;
  3797. }
  3798. return SyntaxError;
  3799. }(Error);
  3800. /***/ }),
  3801. /***/ "./js/ast/error/syntaxErrorFactory.js":
  3802. /*!********************************************!*\
  3803. !*** ./js/ast/error/syntaxErrorFactory.js ***!
  3804. \********************************************/
  3805. /*! no static exports found */
  3806. /***/ (function(module, exports, __webpack_require__) {
  3807. "use strict";
  3808. Object.defineProperty(exports, "__esModule", {
  3809. value: true
  3810. });
  3811. exports.SyntaxErrorFactory = undefined;
  3812. var _localizedStringsService = __webpack_require__(/*! ./../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  3813. var _syntaxError = __webpack_require__(/*! ./syntaxError */ "./js/ast/error/syntaxError.js");
  3814. var SyntaxErrorFactory = exports.SyntaxErrorFactory = Object.freeze({
  3815. extra_lines: function extra_lines() {
  3816. return new _syntaxError.SyntaxError(_localizedStringsService.LocalizedStrings.getError("extra_lines"));
  3817. },
  3818. token_missing_one: function token_missing_one(expected, token) {
  3819. var context = [expected, token.text, token.line, token.column];
  3820. return new _syntaxError.SyntaxError(_localizedStringsService.LocalizedStrings.getError("token_missing_one", context));
  3821. },
  3822. token_missing_list: function token_missing_list(expectedList, token) {
  3823. var line = expectedList.join(_localizedStringsService.LocalizedStrings.getOR());
  3824. return SyntaxErrorFactory.token_missing_one(line, token);
  3825. },
  3826. id_missing: function id_missing(token) {
  3827. var context = [token.text, token.line, token.column];
  3828. return new _syntaxError.SyntaxError(_localizedStringsService.LocalizedStrings.getError("id_missing", context));
  3829. },
  3830. eos_missing: function eos_missing(token) {
  3831. var context = [token.line, token.column];
  3832. return new _syntaxError.SyntaxError(_localizedStringsService.LocalizedStrings.getError("eos_missing", context));
  3833. },
  3834. invalid_array_dimension: function invalid_array_dimension(typeName, token) {
  3835. var context = [token.line, token.column, typeName];
  3836. return new _syntaxError.SyntaxError(_localizedStringsService.LocalizedStrings.getError("invalid_array_dimension", context));
  3837. },
  3838. invalid_array_size: function invalid_array_size(token) {
  3839. var context = [token.line];
  3840. return new _syntaxError.SyntaxError(_localizedStringsService.LocalizedStrings.getError("invalid_array_size", context));
  3841. },
  3842. invalid_main_return: function invalid_main_return(name, typeName, token) {
  3843. var context = [name, typeName, token.line];
  3844. return new _syntaxError.SyntaxError(_localizedStringsService.LocalizedStrings.getError("invalid_main_return", context));
  3845. },
  3846. invalid_var_declaration: function invalid_var_declaration(token) {
  3847. var context = [token.line];
  3848. return new _syntaxError.SyntaxError(_localizedStringsService.LocalizedStrings.getError("invalid_var_declaration", context));
  3849. },
  3850. invalid_break_command: function invalid_break_command(cmdName, token) {
  3851. var context = [token.line, cmdName];
  3852. return new _syntaxError.SyntaxError(_localizedStringsService.LocalizedStrings.getError("invalid_break_command", context));
  3853. },
  3854. invalid_terminal: function invalid_terminal(token) {
  3855. var context = [token.text, token.line, token.column];
  3856. return new _syntaxError.SyntaxError(_localizedStringsService.LocalizedStrings.getError('invalid_terminal', context));
  3857. },
  3858. invalid_type: function invalid_type(list, token) {
  3859. var line = list.join(_localizedStringsService.LocalizedStrings.getOR());
  3860. var context = [token.text, token.line, token.column, line];
  3861. return new _syntaxError.SyntaxError(_localizedStringsService.LocalizedStrings.getError("invalid_type", context));
  3862. },
  3863. const_not_init: function const_not_init(token) {
  3864. var context = [token.line, token.column];
  3865. return new _syntaxError.SyntaxError(_localizedStringsService.LocalizedStrings.getError("const_not_init", context));
  3866. },
  3867. invalid_id_format: function invalid_id_format(token) {
  3868. var context = [token.text, token.line, token.column];
  3869. return new _syntaxError.SyntaxError(_localizedStringsService.LocalizedStrings.getError("invalid_id_format", context));
  3870. },
  3871. duplicate_function: function duplicate_function(token) {
  3872. var context = [token.text, token.line, token.column];
  3873. return new _syntaxError.SyntaxError(_localizedStringsService.LocalizedStrings.getError("duplicate_function", context));
  3874. },
  3875. main_parameters: function main_parameters() {
  3876. return new _syntaxError.SyntaxError(_localizedStringsService.LocalizedStrings.getError("main_parameters"));
  3877. },
  3878. duplicate_variable: function duplicate_variable(token) {
  3879. var context = [token.text, token.line, token.column];
  3880. return new _syntaxError.SyntaxError(_localizedStringsService.LocalizedStrings.getError("duplicate_variable", context));
  3881. }
  3882. });
  3883. /***/ }),
  3884. /***/ "./js/ast/expressions/arrayAccess.js":
  3885. /*!*******************************************!*\
  3886. !*** ./js/ast/expressions/arrayAccess.js ***!
  3887. \*******************************************/
  3888. /*! no static exports found */
  3889. /***/ (function(module, exports, __webpack_require__) {
  3890. "use strict";
  3891. Object.defineProperty(exports, "__esModule", {
  3892. value: true
  3893. });
  3894. exports.ArrayAccess = undefined;
  3895. 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; }; }();
  3896. var _expression = __webpack_require__(/*! ./expression */ "./js/ast/expressions/expression.js");
  3897. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3898. 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; }
  3899. 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; }
  3900. var ArrayAccess = exports.ArrayAccess = function (_Expression) {
  3901. _inherits(ArrayAccess, _Expression);
  3902. function ArrayAccess(id, line, column) {
  3903. _classCallCheck(this, ArrayAccess);
  3904. var _this = _possibleConstructorReturn(this, (ArrayAccess.__proto__ || Object.getPrototypeOf(ArrayAccess)).call(this));
  3905. _this.id = id;
  3906. _this.line = line;
  3907. _this.column = column;
  3908. return _this;
  3909. }
  3910. _createClass(ArrayAccess, [{
  3911. key: 'toString',
  3912. value: function toString() {
  3913. var strLine = this.line.toString();
  3914. var strColumn = null;
  3915. if (this.column) {
  3916. strColumn = this.column.toString();
  3917. }
  3918. if (strColumn) {
  3919. return this.id + '[' + strLine + '][' + strColumn + ']';
  3920. } else {
  3921. return this.id + '[' + strLine + ']';
  3922. }
  3923. }
  3924. }]);
  3925. return ArrayAccess;
  3926. }(_expression.Expression);
  3927. /***/ }),
  3928. /***/ "./js/ast/expressions/arrayLiteral.js":
  3929. /*!********************************************!*\
  3930. !*** ./js/ast/expressions/arrayLiteral.js ***!
  3931. \********************************************/
  3932. /*! no static exports found */
  3933. /***/ (function(module, exports, __webpack_require__) {
  3934. "use strict";
  3935. Object.defineProperty(exports, "__esModule", {
  3936. value: true
  3937. });
  3938. exports.ArrayLiteral = undefined;
  3939. 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; }; }();
  3940. var _literal = __webpack_require__(/*! ./literal */ "./js/ast/expressions/literal.js");
  3941. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3942. 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; }
  3943. 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; }
  3944. var ArrayLiteral = exports.ArrayLiteral = function (_Literal) {
  3945. _inherits(ArrayLiteral, _Literal);
  3946. function ArrayLiteral(type, value) {
  3947. _classCallCheck(this, ArrayLiteral);
  3948. var _this = _possibleConstructorReturn(this, (ArrayLiteral.__proto__ || Object.getPrototypeOf(ArrayLiteral)).call(this, type));
  3949. _this.value = value;
  3950. return _this;
  3951. }
  3952. _createClass(ArrayLiteral, [{
  3953. key: 'validateType',
  3954. value: function validateType() {
  3955. // let valid = true;
  3956. // if(this.columns !== null) {
  3957. // const len = this.columns;
  3958. // const len2 = this.lines;
  3959. // for (let i = len - 1; i >= 0; i--) {
  3960. // for (let j = len2 - 1; j >= 0; j--) {
  3961. // if(this.value[i].value[j].type !== this.subtype) {
  3962. // valid = false;
  3963. // break;
  3964. // }
  3965. // }
  3966. // }
  3967. // } else {
  3968. // const len = this.lines;
  3969. // for (var i = len - 1; i >= 0; i--) {
  3970. // if(this.value[i].type !== this.subtype) {
  3971. // valid = false;
  3972. // break;
  3973. // }
  3974. // }
  3975. // }
  3976. return true; //valid;
  3977. }
  3978. }, {
  3979. key: 'validateSize',
  3980. value: function validateSize() {
  3981. var valid = true;
  3982. if (this.columns !== null) {
  3983. var equalityTest = data.value.map(function (v) {
  3984. return v.length;
  3985. }).reduce(function (old, next) {
  3986. if (old === null) {
  3987. return next;
  3988. } else if (old === next) {
  3989. return old;
  3990. } else {
  3991. return -1;
  3992. }
  3993. }, null);
  3994. valid = equalityTest !== -1;
  3995. }
  3996. return valid;
  3997. }
  3998. }, {
  3999. key: 'toString',
  4000. value: function toString() {
  4001. var strList = this.value.map(function (arrayLiteral) {
  4002. return arrayLiteral.toString();
  4003. });
  4004. return "{" + strList.join(',') + "}";
  4005. }
  4006. }, {
  4007. key: 'subtype',
  4008. get: function get() {
  4009. var element = this.value[0];
  4010. if (element instanceof ArrayLiteral) {
  4011. return element.value[0].type;
  4012. } else {
  4013. return element.type;
  4014. }
  4015. }
  4016. }, {
  4017. key: 'lines',
  4018. get: function get() {
  4019. return this.value.length;
  4020. }
  4021. }, {
  4022. key: 'columns',
  4023. get: function get() {
  4024. var element = this.value[0];
  4025. if (!(element instanceof ArrayLiteral)) {
  4026. return null;
  4027. } else {
  4028. return element.value[0].length;
  4029. }
  4030. }
  4031. }, {
  4032. key: 'isVector',
  4033. get: function get() {
  4034. return this.columns === null;
  4035. }
  4036. }, {
  4037. key: 'isValid',
  4038. get: function get() {
  4039. return true; //this.validateType() && this.validateSize();
  4040. }
  4041. }]);
  4042. return ArrayLiteral;
  4043. }(_literal.Literal);
  4044. /***/ }),
  4045. /***/ "./js/ast/expressions/boolLiteral.js":
  4046. /*!*******************************************!*\
  4047. !*** ./js/ast/expressions/boolLiteral.js ***!
  4048. \*******************************************/
  4049. /*! no static exports found */
  4050. /***/ (function(module, exports, __webpack_require__) {
  4051. "use strict";
  4052. Object.defineProperty(exports, "__esModule", {
  4053. value: true
  4054. });
  4055. exports.BoolLiteral = undefined;
  4056. 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; }; }();
  4057. var _literal = __webpack_require__(/*! ./literal */ "./js/ast/expressions/literal.js");
  4058. var _types = __webpack_require__(/*! ./../../typeSystem/types */ "./js/typeSystem/types.js");
  4059. var _parsers = __webpack_require__(/*! ./../../typeSystem/parsers */ "./js/typeSystem/parsers.js");
  4060. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  4061. 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; }
  4062. 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; }
  4063. var BoolLiteral = exports.BoolLiteral = function (_Literal) {
  4064. _inherits(BoolLiteral, _Literal);
  4065. function BoolLiteral(value) {
  4066. _classCallCheck(this, BoolLiteral);
  4067. var _this = _possibleConstructorReturn(this, (BoolLiteral.__proto__ || Object.getPrototypeOf(BoolLiteral)).call(this, _types.Types.BOOLEAN));
  4068. _this.value = value;
  4069. return _this;
  4070. }
  4071. _createClass(BoolLiteral, [{
  4072. key: 'toString',
  4073. value: function toString() {
  4074. return (0, _parsers.convertBoolToString)(this.value);
  4075. }
  4076. }]);
  4077. return BoolLiteral;
  4078. }(_literal.Literal);
  4079. /***/ }),
  4080. /***/ "./js/ast/expressions/expression.js":
  4081. /*!******************************************!*\
  4082. !*** ./js/ast/expressions/expression.js ***!
  4083. \******************************************/
  4084. /*! no static exports found */
  4085. /***/ (function(module, exports, __webpack_require__) {
  4086. "use strict";
  4087. Object.defineProperty(exports, "__esModule", {
  4088. value: true
  4089. });
  4090. 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; }; }();
  4091. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  4092. var Expression = exports.Expression = function () {
  4093. function Expression() {
  4094. _classCallCheck(this, Expression);
  4095. this._sourceInfo = null;
  4096. }
  4097. _createClass(Expression, [{
  4098. key: "sourceInfo",
  4099. set: function set(sourceInfo) {
  4100. this._sourceInfo = sourceInfo;
  4101. },
  4102. get: function get() {
  4103. return this._sourceInfo;
  4104. }
  4105. }]);
  4106. return Expression;
  4107. }();
  4108. /***/ }),
  4109. /***/ "./js/ast/expressions/functionCall.js":
  4110. /*!********************************************!*\
  4111. !*** ./js/ast/expressions/functionCall.js ***!
  4112. \********************************************/
  4113. /*! no static exports found */
  4114. /***/ (function(module, exports, __webpack_require__) {
  4115. "use strict";
  4116. Object.defineProperty(exports, "__esModule", {
  4117. value: true
  4118. });
  4119. exports.FunctionCall = undefined;
  4120. 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; }; }();
  4121. var _expression = __webpack_require__(/*! ./expression */ "./js/ast/expressions/expression.js");
  4122. var _definedFunctions = __webpack_require__(/*! ../../processor/definedFunctions */ "./js/processor/definedFunctions.js");
  4123. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  4124. 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; }
  4125. 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; }
  4126. var FunctionCall = exports.FunctionCall = function (_Expression) {
  4127. _inherits(FunctionCall, _Expression);
  4128. function FunctionCall(id, actualParameters) {
  4129. _classCallCheck(this, FunctionCall);
  4130. var _this = _possibleConstructorReturn(this, (FunctionCall.__proto__ || Object.getPrototypeOf(FunctionCall)).call(this));
  4131. _this.id = id;
  4132. _this.actualParameters = actualParameters;
  4133. return _this;
  4134. }
  4135. _createClass(FunctionCall, [{
  4136. key: 'toString',
  4137. value: function toString() {
  4138. var name = null;
  4139. if (this.isMainCall) {
  4140. name = _definedFunctions.LanguageDefinedFunction.getMainFunctionName();
  4141. } else {
  4142. name = _definedFunctions.LanguageDefinedFunction.getLocalName(this.id);
  4143. }
  4144. var params = null;
  4145. if (this.actualParameters.length == 0) {
  4146. params = "()";
  4147. } else {
  4148. var strParams = this.actualParameters.map(function (v) {
  4149. return v.toString();
  4150. });
  4151. params = "(" + strParams.join(",") + ")";
  4152. }
  4153. return name + params;
  4154. }
  4155. }, {
  4156. key: 'isMainCall',
  4157. get: function get() {
  4158. return this.id === null;
  4159. }
  4160. }, {
  4161. key: 'parametersSize',
  4162. get: function get() {
  4163. return this.actualParameters.length;
  4164. }
  4165. }]);
  4166. return FunctionCall;
  4167. }(_expression.Expression);
  4168. /***/ }),
  4169. /***/ "./js/ast/expressions/index.js":
  4170. /*!*************************************!*\
  4171. !*** ./js/ast/expressions/index.js ***!
  4172. \*************************************/
  4173. /*! no static exports found */
  4174. /***/ (function(module, exports, __webpack_require__) {
  4175. "use strict";
  4176. Object.defineProperty(exports, "__esModule", {
  4177. value: true
  4178. });
  4179. exports.UnaryApp = exports.InfixApp = exports.VariableLiteral = exports.ArrayLiteral = exports.StringLiteral = exports.BoolLiteral = exports.RealLiteral = exports.IntLiteral = exports.FunctionCall = exports.ArrayAccess = undefined;
  4180. var _arrayAccess = __webpack_require__(/*! ./arrayAccess */ "./js/ast/expressions/arrayAccess.js");
  4181. var _functionCall = __webpack_require__(/*! ./functionCall */ "./js/ast/expressions/functionCall.js");
  4182. var _intLiteral = __webpack_require__(/*! ./intLiteral */ "./js/ast/expressions/intLiteral.js");
  4183. var _realLiteral = __webpack_require__(/*! ./realLiteral */ "./js/ast/expressions/realLiteral.js");
  4184. var _boolLiteral = __webpack_require__(/*! ./boolLiteral */ "./js/ast/expressions/boolLiteral.js");
  4185. var _stringLiteral = __webpack_require__(/*! ./stringLiteral */ "./js/ast/expressions/stringLiteral.js");
  4186. var _arrayLiteral = __webpack_require__(/*! ./arrayLiteral */ "./js/ast/expressions/arrayLiteral.js");
  4187. var _variableLiteral = __webpack_require__(/*! ./variableLiteral */ "./js/ast/expressions/variableLiteral.js");
  4188. var _infixApp = __webpack_require__(/*! ./infixApp */ "./js/ast/expressions/infixApp.js");
  4189. var _unaryApp = __webpack_require__(/*! ./unaryApp */ "./js/ast/expressions/unaryApp.js");
  4190. exports.ArrayAccess = _arrayAccess.ArrayAccess;
  4191. exports.FunctionCall = _functionCall.FunctionCall;
  4192. exports.IntLiteral = _intLiteral.IntLiteral;
  4193. exports.RealLiteral = _realLiteral.RealLiteral;
  4194. exports.BoolLiteral = _boolLiteral.BoolLiteral;
  4195. exports.StringLiteral = _stringLiteral.StringLiteral;
  4196. exports.ArrayLiteral = _arrayLiteral.ArrayLiteral;
  4197. exports.VariableLiteral = _variableLiteral.VariableLiteral;
  4198. exports.InfixApp = _infixApp.InfixApp;
  4199. exports.UnaryApp = _unaryApp.UnaryApp;
  4200. /***/ }),
  4201. /***/ "./js/ast/expressions/infixApp.js":
  4202. /*!****************************************!*\
  4203. !*** ./js/ast/expressions/infixApp.js ***!
  4204. \****************************************/
  4205. /*! no static exports found */
  4206. /***/ (function(module, exports, __webpack_require__) {
  4207. "use strict";
  4208. Object.defineProperty(exports, "__esModule", {
  4209. value: true
  4210. });
  4211. exports.InfixApp = undefined;
  4212. 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; }; }();
  4213. var _expression = __webpack_require__(/*! ./expression */ "./js/ast/expressions/expression.js");
  4214. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  4215. 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; }
  4216. 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; }
  4217. var InfixApp = exports.InfixApp = function (_Expression) {
  4218. _inherits(InfixApp, _Expression);
  4219. function InfixApp(op, left, right) {
  4220. _classCallCheck(this, InfixApp);
  4221. var _this = _possibleConstructorReturn(this, (InfixApp.__proto__ || Object.getPrototypeOf(InfixApp)).call(this));
  4222. _this.op = op;
  4223. _this.left = left;
  4224. _this.right = right;
  4225. return _this;
  4226. }
  4227. _createClass(InfixApp, [{
  4228. key: 'toString',
  4229. value: function toString() {
  4230. var l = this.left.toString();
  4231. var op = this.op.value;
  4232. var r = this.right.toString();
  4233. return l + op + r;
  4234. }
  4235. }]);
  4236. return InfixApp;
  4237. }(_expression.Expression);
  4238. /***/ }),
  4239. /***/ "./js/ast/expressions/intLiteral.js":
  4240. /*!******************************************!*\
  4241. !*** ./js/ast/expressions/intLiteral.js ***!
  4242. \******************************************/
  4243. /*! no static exports found */
  4244. /***/ (function(module, exports, __webpack_require__) {
  4245. "use strict";
  4246. Object.defineProperty(exports, "__esModule", {
  4247. value: true
  4248. });
  4249. exports.IntLiteral = undefined;
  4250. 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; }; }();
  4251. var _literal = __webpack_require__(/*! ./literal */ "./js/ast/expressions/literal.js");
  4252. var _types = __webpack_require__(/*! ./../../typeSystem/types */ "./js/typeSystem/types.js");
  4253. var _parsers = __webpack_require__(/*! ./../../typeSystem/parsers */ "./js/typeSystem/parsers.js");
  4254. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  4255. 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; }
  4256. 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; }
  4257. var IntLiteral = exports.IntLiteral = function (_Literal) {
  4258. _inherits(IntLiteral, _Literal);
  4259. function IntLiteral(value) {
  4260. _classCallCheck(this, IntLiteral);
  4261. var _this = _possibleConstructorReturn(this, (IntLiteral.__proto__ || Object.getPrototypeOf(IntLiteral)).call(this, _types.Types.INTEGER));
  4262. _this.value = value;
  4263. return _this;
  4264. }
  4265. _createClass(IntLiteral, [{
  4266. key: 'toString',
  4267. value: function toString() {
  4268. return (0, _parsers.convertToString)(this.value, this.type);
  4269. }
  4270. }]);
  4271. return IntLiteral;
  4272. }(_literal.Literal);
  4273. /***/ }),
  4274. /***/ "./js/ast/expressions/literal.js":
  4275. /*!***************************************!*\
  4276. !*** ./js/ast/expressions/literal.js ***!
  4277. \***************************************/
  4278. /*! no static exports found */
  4279. /***/ (function(module, exports, __webpack_require__) {
  4280. "use strict";
  4281. Object.defineProperty(exports, "__esModule", {
  4282. value: true
  4283. });
  4284. exports.Literal = undefined;
  4285. var _expression = __webpack_require__(/*! ./expression */ "./js/ast/expressions/expression.js");
  4286. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  4287. 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; }
  4288. 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; }
  4289. var Literal = exports.Literal = function (_Expression) {
  4290. _inherits(Literal, _Expression);
  4291. function Literal(type) {
  4292. _classCallCheck(this, Literal);
  4293. var _this = _possibleConstructorReturn(this, (Literal.__proto__ || Object.getPrototypeOf(Literal)).call(this));
  4294. _this.type = type;
  4295. return _this;
  4296. }
  4297. return Literal;
  4298. }(_expression.Expression);
  4299. /***/ }),
  4300. /***/ "./js/ast/expressions/realLiteral.js":
  4301. /*!*******************************************!*\
  4302. !*** ./js/ast/expressions/realLiteral.js ***!
  4303. \*******************************************/
  4304. /*! no static exports found */
  4305. /***/ (function(module, exports, __webpack_require__) {
  4306. "use strict";
  4307. Object.defineProperty(exports, "__esModule", {
  4308. value: true
  4309. });
  4310. exports.RealLiteral = undefined;
  4311. 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; }; }();
  4312. var _literal = __webpack_require__(/*! ./literal */ "./js/ast/expressions/literal.js");
  4313. var _types = __webpack_require__(/*! ./../../typeSystem/types */ "./js/typeSystem/types.js");
  4314. var _parsers = __webpack_require__(/*! ./../../typeSystem/parsers */ "./js/typeSystem/parsers.js");
  4315. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  4316. 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; }
  4317. 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; }
  4318. var RealLiteral = exports.RealLiteral = function (_Literal) {
  4319. _inherits(RealLiteral, _Literal);
  4320. function RealLiteral(value) {
  4321. _classCallCheck(this, RealLiteral);
  4322. var _this = _possibleConstructorReturn(this, (RealLiteral.__proto__ || Object.getPrototypeOf(RealLiteral)).call(this, _types.Types.REAL));
  4323. _this.value = value;
  4324. return _this;
  4325. }
  4326. _createClass(RealLiteral, [{
  4327. key: 'toString',
  4328. value: function toString() {
  4329. return (0, _parsers.convertToString)(this.value, this.type);
  4330. }
  4331. }]);
  4332. return RealLiteral;
  4333. }(_literal.Literal);
  4334. /***/ }),
  4335. /***/ "./js/ast/expressions/stringLiteral.js":
  4336. /*!*********************************************!*\
  4337. !*** ./js/ast/expressions/stringLiteral.js ***!
  4338. \*********************************************/
  4339. /*! no static exports found */
  4340. /***/ (function(module, exports, __webpack_require__) {
  4341. "use strict";
  4342. Object.defineProperty(exports, "__esModule", {
  4343. value: true
  4344. });
  4345. exports.StringLiteral = undefined;
  4346. 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; }; }();
  4347. var _literal = __webpack_require__(/*! ./literal */ "./js/ast/expressions/literal.js");
  4348. var _types = __webpack_require__(/*! ./../../typeSystem/types */ "./js/typeSystem/types.js");
  4349. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  4350. 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; }
  4351. 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; }
  4352. var StringLiteral = exports.StringLiteral = function (_Literal) {
  4353. _inherits(StringLiteral, _Literal);
  4354. function StringLiteral(value) {
  4355. _classCallCheck(this, StringLiteral);
  4356. var _this = _possibleConstructorReturn(this, (StringLiteral.__proto__ || Object.getPrototypeOf(StringLiteral)).call(this, _types.Types.STRING));
  4357. _this.value = value;
  4358. return _this;
  4359. }
  4360. _createClass(StringLiteral, [{
  4361. key: 'toString',
  4362. value: function toString() {
  4363. return this.value;
  4364. }
  4365. }]);
  4366. return StringLiteral;
  4367. }(_literal.Literal);
  4368. /***/ }),
  4369. /***/ "./js/ast/expressions/unaryApp.js":
  4370. /*!****************************************!*\
  4371. !*** ./js/ast/expressions/unaryApp.js ***!
  4372. \****************************************/
  4373. /*! no static exports found */
  4374. /***/ (function(module, exports, __webpack_require__) {
  4375. "use strict";
  4376. Object.defineProperty(exports, "__esModule", {
  4377. value: true
  4378. });
  4379. exports.UnaryApp = undefined;
  4380. 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; }; }();
  4381. var _infixApp = __webpack_require__(/*! ./infixApp */ "./js/ast/expressions/infixApp.js");
  4382. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  4383. 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; }
  4384. 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; }
  4385. var UnaryApp = exports.UnaryApp = function (_InfixApp) {
  4386. _inherits(UnaryApp, _InfixApp);
  4387. function UnaryApp(op, left) {
  4388. _classCallCheck(this, UnaryApp);
  4389. return _possibleConstructorReturn(this, (UnaryApp.__proto__ || Object.getPrototypeOf(UnaryApp)).call(this, op, left, null));
  4390. }
  4391. _createClass(UnaryApp, [{
  4392. key: 'toString',
  4393. value: function toString() {
  4394. var l = this.left.toString();
  4395. var op = this.op.value;
  4396. return op + l;
  4397. }
  4398. }]);
  4399. return UnaryApp;
  4400. }(_infixApp.InfixApp);
  4401. /***/ }),
  4402. /***/ "./js/ast/expressions/variableLiteral.js":
  4403. /*!***********************************************!*\
  4404. !*** ./js/ast/expressions/variableLiteral.js ***!
  4405. \***********************************************/
  4406. /*! no static exports found */
  4407. /***/ (function(module, exports, __webpack_require__) {
  4408. "use strict";
  4409. Object.defineProperty(exports, "__esModule", {
  4410. value: true
  4411. });
  4412. exports.VariableLiteral = undefined;
  4413. 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; }; }();
  4414. var _literal = __webpack_require__(/*! ./literal */ "./js/ast/expressions/literal.js");
  4415. var _types = __webpack_require__(/*! ./../../typeSystem/types */ "./js/typeSystem/types.js");
  4416. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  4417. 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; }
  4418. 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; }
  4419. var VariableLiteral = exports.VariableLiteral = function (_Literal) {
  4420. _inherits(VariableLiteral, _Literal);
  4421. function VariableLiteral(id) {
  4422. _classCallCheck(this, VariableLiteral);
  4423. var _this = _possibleConstructorReturn(this, (VariableLiteral.__proto__ || Object.getPrototypeOf(VariableLiteral)).call(this, _types.Types.UNDEFINED));
  4424. _this.id = id;
  4425. return _this;
  4426. }
  4427. _createClass(VariableLiteral, [{
  4428. key: 'toString',
  4429. value: function toString() {
  4430. return this.id;
  4431. }
  4432. }]);
  4433. return VariableLiteral;
  4434. }(_literal.Literal);
  4435. /***/ }),
  4436. /***/ "./js/ast/ivprogParser.js":
  4437. /*!********************************!*\
  4438. !*** ./js/ast/ivprogParser.js ***!
  4439. \********************************/
  4440. /*! no static exports found */
  4441. /***/ (function(module, exports, __webpack_require__) {
  4442. "use strict";
  4443. Object.defineProperty(exports, "__esModule", {
  4444. value: true
  4445. });
  4446. exports.IVProgParser = undefined;
  4447. 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; }; }();
  4448. var _index = __webpack_require__(/*! antlr4/index */ "./node_modules/antlr4/index.js");
  4449. var _expressions = __webpack_require__(/*! ./expressions/ */ "./js/ast/expressions/index.js");
  4450. var Expressions = _interopRequireWildcard(_expressions);
  4451. var _commands = __webpack_require__(/*! ./commands/ */ "./js/ast/commands/index.js");
  4452. var Commands = _interopRequireWildcard(_commands);
  4453. var _parsers = __webpack_require__(/*! ./../typeSystem/parsers */ "./js/typeSystem/parsers.js");
  4454. var _types = __webpack_require__(/*! ./../typeSystem/types */ "./js/typeSystem/types.js");
  4455. var _compoundType = __webpack_require__(/*! ./../typeSystem/compoundType */ "./js/typeSystem/compoundType.js");
  4456. var _sourceInfo2 = __webpack_require__(/*! ./sourceInfo */ "./js/ast/sourceInfo.js");
  4457. var _operators = __webpack_require__(/*! ./operators */ "./js/ast/operators.js");
  4458. var _syntaxErrorFactory = __webpack_require__(/*! ./error/syntaxErrorFactory */ "./js/ast/error/syntaxErrorFactory.js");
  4459. var _definedFunctions = __webpack_require__(/*! ./../processor/definedFunctions */ "./js/processor/definedFunctions.js");
  4460. var _languageService = __webpack_require__(/*! ../services/languageService */ "./js/services/languageService.js");
  4461. 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; } }
  4462. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  4463. var IVProgParser = exports.IVProgParser = function () {
  4464. _createClass(IVProgParser, null, [{
  4465. key: 'createParser',
  4466. value: function createParser(input) {
  4467. var lexerClass = _languageService.LanguageService.getCurrentLexer();
  4468. return new IVProgParser(input, lexerClass);
  4469. }
  4470. // <BEGIN scope consts>
  4471. }, {
  4472. key: 'BASE',
  4473. get: function get() {
  4474. return 0;
  4475. }
  4476. }, {
  4477. key: 'FUNCTION',
  4478. get: function get() {
  4479. return 1;
  4480. }
  4481. }, {
  4482. key: 'COMMAND',
  4483. get: function get() {
  4484. return 2;
  4485. }
  4486. }, {
  4487. key: 'BREAKABLE',
  4488. get: function get() {
  4489. return 4;
  4490. }
  4491. // </ END scope consts>
  4492. }]);
  4493. function IVProgParser(input, lexerClass) {
  4494. _classCallCheck(this, IVProgParser);
  4495. this.lexerClass = lexerClass;
  4496. this.lexer = new lexerClass(new _index.InputStream(input));
  4497. this.tokenStream = new _index.CommonTokenStream(this.lexer);
  4498. this.tokenStream.fill();
  4499. this.pos = 1;
  4500. this.variableTypes = [this.lexerClass.RK_INTEGER, this.lexerClass.RK_REAL, this.lexerClass.RK_BOOLEAN, this.lexerClass.RK_STRING];
  4501. this.functionTypes = this.variableTypes.concat(this.lexerClass.RK_VOID);
  4502. this.parsingArrayDimension = 0;
  4503. this.scope = [];
  4504. this.langFuncs = _languageService.LanguageService.getCurrentLangFuncs();
  4505. this.definedFuncsNameList = [];
  4506. this.definedVariablesStack = [];
  4507. }
  4508. _createClass(IVProgParser, [{
  4509. key: 'parseTree',
  4510. value: function parseTree() {
  4511. return this.parseProgram();
  4512. }
  4513. }, {
  4514. key: 'getToken',
  4515. value: function getToken() {
  4516. var index = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.pos;
  4517. // if(index === null)
  4518. // index = this.pos;
  4519. return this.tokenStream.LT(index);
  4520. }
  4521. }, {
  4522. key: 'insideScope',
  4523. value: function insideScope(scope) {
  4524. if (this.scope.length <= 0) {
  4525. return IVProgParser.BASE === scope;
  4526. } else {
  4527. return this.scope[this.scope.length - 1] === scope;
  4528. }
  4529. }
  4530. }, {
  4531. key: 'pushScope',
  4532. value: function pushScope(scope) {
  4533. this.scope.push(scope);
  4534. }
  4535. }, {
  4536. key: 'pushVariableStack',
  4537. value: function pushVariableStack() {
  4538. this.definedVariablesStack.push([]);
  4539. }
  4540. }, {
  4541. key: 'popScope',
  4542. value: function popScope() {
  4543. return this.scope.pop();
  4544. }
  4545. }, {
  4546. key: 'popVariableStack',
  4547. value: function popVariableStack() {
  4548. return this.definedVariablesStack.pop();
  4549. }
  4550. }, {
  4551. key: 'getCurrentVariableStack',
  4552. value: function getCurrentVariableStack() {
  4553. return this.definedVariablesStack[this.definedVariablesStack.length - 1];
  4554. }
  4555. }, {
  4556. key: 'isEOF',
  4557. value: function isEOF() {
  4558. this.getToken(this.pos);
  4559. return this.tokenStream.fetchedEOF;
  4560. }
  4561. }, {
  4562. key: 'parseProgram',
  4563. value: function parseProgram() {
  4564. var token = this.getToken();
  4565. var globalVars = [];
  4566. var functions = [];
  4567. if (this.lexerClass.RK_PROGRAM === token.type) {
  4568. this.pos++;
  4569. this.consumeNewLines();
  4570. this.checkOpenCurly();
  4571. this.pos++;
  4572. this.pushVariableStack();
  4573. while (true) {
  4574. this.consumeNewLines();
  4575. var _token = this.getToken();
  4576. if (_token.type === this.lexerClass.RK_CONST || this.isVariableType(_token)) {
  4577. globalVars = globalVars.concat(this.parseGlobalVariables());
  4578. } else if (_token.type === this.lexerClass.RK_FUNCTION) {
  4579. this.pushVariableStack();
  4580. functions = functions.concat(this.parseFunction());
  4581. this.popVariableStack();
  4582. } else {
  4583. break;
  4584. }
  4585. }
  4586. this.consumeNewLines();
  4587. this.checkCloseCurly();
  4588. this.pos++;
  4589. this.consumeNewLines();
  4590. if (!this.isEOF()) {
  4591. throw _syntaxErrorFactory.SyntaxErrorFactory.extra_lines();
  4592. }
  4593. this.popVariableStack();
  4594. return { global: globalVars, functions: functions };
  4595. } else {
  4596. throw _syntaxErrorFactory.SyntaxErrorFactory.token_missing_one(this.lexer.literalNames[this.lexerClass.RK_PROGRAM], token);
  4597. }
  4598. }
  4599. }, {
  4600. key: 'checkOpenCurly',
  4601. value: function checkOpenCurly() {
  4602. var attempt = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  4603. var token = this.getToken();
  4604. if (this.lexerClass.OPEN_CURLY !== token.type) {
  4605. if (!attempt) throw _syntaxErrorFactory.SyntaxErrorFactory.token_missing_one('{', token);else return false;
  4606. }
  4607. return true;
  4608. }
  4609. }, {
  4610. key: 'checkCloseCurly',
  4611. value: function checkCloseCurly() {
  4612. var attempt = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  4613. var token = this.getToken();
  4614. if (this.lexerClass.CLOSE_CURLY !== token.type) {
  4615. if (!attempt) throw _syntaxErrorFactory.SyntaxErrorFactory.token_missing_one('}', token);else return false;
  4616. }
  4617. return true;
  4618. }
  4619. /* It checks if the current token at position pos is a ']'.
  4620. * As a check function it doesn't increment pos.
  4621. *
  4622. * @params bool:attempt, indicates that the token is optional. Defaults: false
  4623. *
  4624. * @returns true if the attempt is true and current token is '[',
  4625. * false is attempt is true and current token is not '['
  4626. **/
  4627. }, {
  4628. key: 'checkOpenBrace',
  4629. value: function checkOpenBrace() {
  4630. var attempt = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  4631. var token = this.getToken();
  4632. if (this.lexerClass.OPEN_BRACE !== token.type) {
  4633. if (!attempt) {
  4634. throw _syntaxErrorFactory.SyntaxErrorFactory.token_missing_one('[', token);
  4635. } else {
  4636. return false;
  4637. }
  4638. }
  4639. return true;
  4640. }
  4641. }, {
  4642. key: 'checkCloseBrace',
  4643. value: function checkCloseBrace() {
  4644. var attempt = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  4645. var token = this.getToken();
  4646. if (this.lexerClass.CLOSE_BRACE !== token.type) {
  4647. if (!attempt) {
  4648. throw _syntaxErrorFactory.SyntaxErrorFactory.token_missing_one(']', token);
  4649. } else {
  4650. return false;
  4651. }
  4652. }
  4653. return true;
  4654. }
  4655. }, {
  4656. key: 'checkOpenParenthesis',
  4657. value: function checkOpenParenthesis() {
  4658. var attempt = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  4659. var token = this.getToken();
  4660. if (this.lexerClass.OPEN_PARENTHESIS !== token.type) {
  4661. if (!attempt) {
  4662. throw _syntaxErrorFactory.SyntaxErrorFactory.token_missing_one('(', token);
  4663. } else {
  4664. return false;
  4665. }
  4666. }
  4667. return true;
  4668. }
  4669. }, {
  4670. key: 'checkCloseParenthesis',
  4671. value: function checkCloseParenthesis() {
  4672. var attempt = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  4673. var token = this.getToken();
  4674. if (this.lexerClass.CLOSE_PARENTHESIS !== token.type) {
  4675. if (!attempt) {
  4676. throw _syntaxErrorFactory.SyntaxErrorFactory.token_missing_one(')', token);
  4677. } else {
  4678. return false;
  4679. }
  4680. }
  4681. return true;
  4682. }
  4683. }, {
  4684. key: 'checkEOS',
  4685. value: function checkEOS() {
  4686. var attempt = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  4687. var eosToken = this.getToken();
  4688. if (eosToken.type !== this.lexerClass.EOS) {
  4689. if (!attempt) throw _syntaxErrorFactory.SyntaxErrorFactory.eos_missing(eosToken);else return false;
  4690. }
  4691. return true;
  4692. }
  4693. }, {
  4694. key: 'checkFunctionDuplicate',
  4695. value: function checkFunctionDuplicate(functionID, funcIDToken) {
  4696. var id = functionID === null ? "$main" : functionID;
  4697. var index = this.definedFuncsNameList.indexOf(id);
  4698. if (index !== -1) {
  4699. throw _syntaxErrorFactory.SyntaxErrorFactory.duplicate_function(funcIDToken);
  4700. }
  4701. this.definedFuncsNameList.push(id);
  4702. }
  4703. }, {
  4704. key: 'checkVariableDuplicate',
  4705. value: function checkVariableDuplicate(variableID, variableIDToken) {
  4706. var index = this.getCurrentVariableStack().indexOf(variableID);
  4707. if (index !== -1) {
  4708. throw _syntaxErrorFactory.SyntaxErrorFactory.duplicate_variable(variableIDToken);
  4709. }
  4710. this.getCurrentVariableStack().push(variableID);
  4711. }
  4712. }, {
  4713. key: 'consumeForSemiColon',
  4714. value: function consumeForSemiColon() {
  4715. var eosToken = this.getToken();
  4716. if (eosToken.type === this.lexerClass.EOS && eosToken.text.match(';')) {
  4717. this.pos++;
  4718. return;
  4719. }
  4720. throw _syntaxErrorFactory.SyntaxErrorFactory.token_missing_one(';', eosToken);
  4721. }
  4722. }, {
  4723. key: 'parseGlobalVariables',
  4724. value: function parseGlobalVariables() {
  4725. var decl = this.parseMaybeConst();
  4726. this.checkEOS();
  4727. this.pos++;
  4728. return decl;
  4729. }
  4730. /*
  4731. * Checks if the next token is PR_CONST. It's only available
  4732. * at global variables declaration level
  4733. * @returns Declararion(const, type, id, initVal?)
  4734. **/
  4735. }, {
  4736. key: 'parseMaybeConst',
  4737. value: function parseMaybeConst() {
  4738. var constToken = this.getToken();
  4739. if (constToken.type === this.lexerClass.RK_CONST) {
  4740. this.pos++;
  4741. var typeString = this.parseType();
  4742. return this.parseDeclaration(typeString, true);
  4743. } else if (this.isVariableType(constToken)) {
  4744. var _typeString = this.parseType();
  4745. return this.parseDeclaration(_typeString);
  4746. } else {
  4747. throw _syntaxErrorFactory.SyntaxErrorFactory.token_missing_list([this.lexer.literalNames[this.lexerClass.RK_CONST]].concat(this.getTypeArray()), constToken);
  4748. }
  4749. }
  4750. /*
  4751. * Parses a declarion of the form: type --- id --- (= --- EAnd)?
  4752. * @returns a list of Declararion(const, type, id, initVal?)
  4753. **/
  4754. }, {
  4755. key: 'parseDeclaration',
  4756. value: function parseDeclaration(typeString) {
  4757. var isConst = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  4758. var initial = null;
  4759. var dim1 = null;
  4760. var dim2 = null;
  4761. var idToken = this.getToken();
  4762. var idString = this.parseID();
  4763. this.checkVariableDuplicate(idString, idToken);
  4764. // Check for array or vector
  4765. // ID[int/IDi][int/IDj]
  4766. if (this.checkOpenBrace(true)) {
  4767. this.pos++;
  4768. this.consumeNewLines();
  4769. dim1 = this.parseArrayDimension();
  4770. this.consumeNewLines();
  4771. this.checkCloseBrace();
  4772. this.pos++;
  4773. if (this.checkOpenBrace(true)) {
  4774. this.pos++;
  4775. this.consumeNewLines();
  4776. dim2 = this.parseArrayDimension();
  4777. this.consumeNewLines();
  4778. this.checkCloseBrace();
  4779. this.pos++;
  4780. }
  4781. }
  4782. var equalsToken = this.getToken();
  4783. if (isConst && equalsToken.type !== this.lexerClass.EQUAL) {
  4784. throw _syntaxErrorFactory.SyntaxErrorFactory.const_not_init(idToken);
  4785. }
  4786. if (equalsToken.type === this.lexerClass.EQUAL) {
  4787. this.pos++;
  4788. initial = this.parseExpressionOR();
  4789. }
  4790. var declaration = null;
  4791. var dimensions = 0;
  4792. if (dim1 !== null) {
  4793. dimensions++;
  4794. if (dim2 !== null) {
  4795. dimensions++;
  4796. }
  4797. declaration = new Commands.ArrayDeclaration(idString, new _compoundType.CompoundType(typeString, dimensions), dim1, dim2, initial, isConst);
  4798. } else {
  4799. declaration = new Commands.Declaration(idString, typeString, initial, isConst);
  4800. }
  4801. declaration.sourceInfo = _sourceInfo2.SourceInfo.createSourceInfo(idToken);
  4802. var commaToken = this.getToken();
  4803. if (commaToken.type === this.lexerClass.COMMA) {
  4804. this.pos++;
  4805. this.consumeNewLines();
  4806. return [declaration].concat(this.parseDeclaration(typeString, isConst));
  4807. } else {
  4808. return [declaration];
  4809. }
  4810. }
  4811. }, {
  4812. key: 'consumeNewLines',
  4813. value: function consumeNewLines() {
  4814. var token = this.getToken();
  4815. while (token.type === this.lexerClass.EOS && token.text.match('[\r\n]+')) {
  4816. this.pos++;
  4817. token = this.getToken();
  4818. }
  4819. }
  4820. }, {
  4821. key: 'isVariableType',
  4822. value: function isVariableType(token) {
  4823. return this.variableTypes.find(function (v) {
  4824. return v === token.type;
  4825. });
  4826. }
  4827. /*
  4828. * Reads the next token of the stream to check if it is a Integer or an ID.
  4829. * @returns Integer | ID
  4830. **/
  4831. }, {
  4832. key: 'parseArrayDimension',
  4833. value: function parseArrayDimension() {
  4834. var dimToken = this.getToken();
  4835. if (dimToken.type === this.lexerClass.INTEGER) {
  4836. //parse as int literal
  4837. this.pos++;
  4838. return this.getIntLiteral(dimToken);
  4839. } else if (dimToken.type === this.lexerClass.ID) {
  4840. //parse as variable
  4841. this.pos++;
  4842. return this.parseVariable(dimToken);
  4843. } else {
  4844. throw _syntaxErrorFactory.SyntaxErrorFactory.invalid_array_dimension(this.lexer.literalNames[this.lexerClass.RK_INTEGER], dimToken);
  4845. }
  4846. }
  4847. /*
  4848. * Returns an object {type: 'int', value: value}.
  4849. * It checks for binary and hexadecimal integers.
  4850. * @returns object with fields type and value
  4851. **/
  4852. }, {
  4853. key: 'getIntLiteral',
  4854. value: function getIntLiteral(token) {
  4855. var text = token.text;
  4856. var sourceInfo = _sourceInfo2.SourceInfo.createSourceInfo(token);
  4857. var exp = new Expressions.IntLiteral((0, _parsers.toInt)(text));
  4858. exp.sourceInfo = sourceInfo;
  4859. return exp;
  4860. }
  4861. }, {
  4862. key: 'getRealLiteral',
  4863. value: function getRealLiteral(token) {
  4864. var sourceInfo = _sourceInfo2.SourceInfo.createSourceInfo(token);
  4865. var exp = new Expressions.RealLiteral((0, _parsers.toReal)(token.text));
  4866. exp.sourceInfo = sourceInfo;
  4867. return exp;
  4868. }
  4869. }, {
  4870. key: 'getStringLiteral',
  4871. value: function getStringLiteral(token) {
  4872. var text = token.text;
  4873. var sourceInfo = _sourceInfo2.SourceInfo.createSourceInfo(token);
  4874. var exp = new Expressions.StringLiteral((0, _parsers.toString)(text));
  4875. exp.sourceInfo = sourceInfo;
  4876. return exp;
  4877. }
  4878. }, {
  4879. key: 'getBoolLiteral',
  4880. value: function getBoolLiteral(token) {
  4881. var val = (0, _parsers.toBool)(token.text);
  4882. var exp = new Expressions.BoolLiteral(val);
  4883. exp.sourceInfo = _sourceInfo2.SourceInfo.createSourceInfo(token);;
  4884. return exp;
  4885. }
  4886. }, {
  4887. key: 'parseArrayLiteral',
  4888. value: function parseArrayLiteral() {
  4889. this.checkOpenCurly();
  4890. var beginArray = this.getToken();
  4891. if (this.parsingArrayDimension >= 2) {
  4892. throw _syntaxErrorFactory.SyntaxErrorFactory.token_missing_list('Array dimensions exceed maximum size of 2 at line ' + beginArray.line);
  4893. }
  4894. this.pos++;
  4895. this.parsingArrayDimension++;
  4896. this.consumeNewLines();
  4897. var data = this.parseExpressionList();
  4898. this.consumeNewLines();
  4899. this.checkCloseCurly();
  4900. var endArray = this.getToken();
  4901. this.pos++;
  4902. this.parsingArrayDimension--;
  4903. if (this.parsingArrayDimension === 0) {
  4904. // if (!data.isValid) {
  4905. // // TODO: better error message
  4906. // console.log('invalid array');
  4907. // throw new Error(`Invalid array at line ${beginArray.line}`);
  4908. // }
  4909. }
  4910. var sourceInfo = _sourceInfo2.SourceInfo.createSourceInfoFromList(beginArray, endArray);
  4911. var dataDim = 1;
  4912. if (data[0] instanceof Expressions.ArrayLiteral) {
  4913. dataDim++;
  4914. }
  4915. var type = new _compoundType.CompoundType(_types.Types.UNDEFINED, dataDim);
  4916. var exp = new Expressions.ArrayLiteral(type, data);
  4917. exp.sourceInfo = sourceInfo;
  4918. return exp;
  4919. }
  4920. /*
  4921. * Returns an object {type: 'variable', value: value}.
  4922. * @returns object with fields type and value
  4923. **/
  4924. }, {
  4925. key: 'parseVariable',
  4926. value: function parseVariable(token) {
  4927. var sourceInfo = _sourceInfo2.SourceInfo.createSourceInfo(token);
  4928. var exp = new Expressions.VariableLiteral(token.text);
  4929. exp.sourceInfo = sourceInfo;
  4930. return exp;
  4931. }
  4932. /*
  4933. * Returns an object representing a function. It has
  4934. * four attributes: returnType, id, formalParams and block.
  4935. * The block object has two attributes: declarations and commands
  4936. **/
  4937. }, {
  4938. key: 'parseFunction',
  4939. value: function parseFunction() {
  4940. this.pushScope(IVProgParser.FUNCTION);
  4941. var formalParams = [];
  4942. var token = this.getToken();
  4943. if (token.type !== this.lexerClass.RK_FUNCTION) {
  4944. //throw SyntaxError.createError(this.lexer.literalNames[this.lexerClass.PR_FUNCAO], token);
  4945. return null;
  4946. }
  4947. this.pos++;
  4948. var funType = this.parseType();
  4949. var dimensions = 0;
  4950. if (this.checkOpenBrace(true)) {
  4951. this.pos++;
  4952. this.checkCloseBrace();
  4953. this.pos++;
  4954. dimensions++;
  4955. if (this.checkOpenBrace(true)) {
  4956. this.pos++;
  4957. this.checkCloseBrace();
  4958. this.pos++;
  4959. dimensions++;
  4960. }
  4961. }
  4962. var funcIDToken = this.getToken();
  4963. var functionID = this.parseID();
  4964. this.checkFunctionDuplicate(functionID, funcIDToken);
  4965. this.checkOpenParenthesis();
  4966. this.pos++;
  4967. this.consumeNewLines();
  4968. if (!this.checkCloseParenthesis(true)) {
  4969. formalParams = this.parseFormalParameters(); // formal parameters
  4970. this.consumeNewLines();
  4971. this.checkCloseParenthesis();
  4972. this.pos++;
  4973. } else {
  4974. this.pos++;
  4975. }
  4976. this.consumeNewLines();
  4977. var commandsBlock = this.parseCommandBlock();
  4978. var returnType = funType;
  4979. if (dimensions > 0) {
  4980. returnType = new _compoundType.CompoundType(funType, dimensions);
  4981. }
  4982. var func = new Commands.Function(functionID, returnType, formalParams, commandsBlock);
  4983. if (functionID === null && !func.isMain) {
  4984. throw _syntaxErrorFactory.SyntaxErrorFactory.invalid_main_return(_definedFunctions.LanguageDefinedFunction.getMainFunctionName(), this.lexer.literalNames[this.lexerClass.RK_VOID], token.line);
  4985. } else if (func.isMain && formalParams.length !== 0) {
  4986. throw _syntaxErrorFactory.SyntaxErrorFactory.main_parameters();
  4987. }
  4988. this.popScope();
  4989. return func;
  4990. }
  4991. /*
  4992. * Parse the formal parameters of a function.
  4993. * @returns a list of objects with the following attributes: type, id and dimensions.
  4994. **/
  4995. }, {
  4996. key: 'parseFormalParameters',
  4997. value: function parseFormalParameters() {
  4998. var list = [];
  4999. while (true) {
  5000. var dimensions = 0;
  5001. var typeString = this.parseType();
  5002. var idToken = this.getToken();
  5003. var idString = this.parseID();
  5004. this.checkVariableDuplicate(idString, idToken);
  5005. if (this.checkOpenBrace(true)) {
  5006. this.pos++;
  5007. dimensions++;
  5008. this.checkCloseBrace();
  5009. this.pos++;
  5010. if (this.checkOpenBrace(true)) {
  5011. this.pos++;
  5012. dimensions++;
  5013. this.checkCloseBrace();
  5014. this.pos++;
  5015. }
  5016. }
  5017. var type = null;
  5018. if (dimensions > 0) {
  5019. type = new _compoundType.CompoundType(typeString, dimensions);
  5020. } else {
  5021. type = typeString;
  5022. }
  5023. list.push(new Commands.FormalParameter(type, idString));
  5024. var commaToken = this.getToken();
  5025. if (commaToken.type !== this.lexerClass.COMMA) break;
  5026. this.pos++;
  5027. this.consumeNewLines();
  5028. }
  5029. return list;
  5030. }
  5031. }, {
  5032. key: 'parseID',
  5033. value: function parseID() {
  5034. var token = this.getToken();
  5035. if (token.type !== this.lexerClass.ID) {
  5036. throw _syntaxErrorFactory.SyntaxErrorFactory.id_missing(token);
  5037. }
  5038. this.pos++;
  5039. if (this.insideScope(IVProgParser.FUNCTION)) {
  5040. if (token.text === _definedFunctions.LanguageDefinedFunction.getMainFunctionName()) {
  5041. return null;
  5042. }
  5043. }
  5044. return token.text;
  5045. }
  5046. }, {
  5047. key: 'parseMaybeLibID',
  5048. value: function parseMaybeLibID() {
  5049. var token = this.getToken();
  5050. if (token.type !== this.lexerClass.ID && token.type !== this.lexerClass.LIB_ID) {
  5051. throw _syntaxErrorFactory.SyntaxErrorFactory.id_missing(token);
  5052. }
  5053. this.pos++;
  5054. return token.text;
  5055. }
  5056. }, {
  5057. key: 'parseType',
  5058. value: function parseType() {
  5059. var token = this.getToken();
  5060. if (token.type === this.lexerClass.ID && this.insideScope(IVProgParser.FUNCTION)) {
  5061. return _types.Types.VOID;
  5062. } else if (token.type === this.lexerClass.RK_VOID && this.insideScope(IVProgParser.FUNCTION)) {
  5063. this.pos++;
  5064. return _types.Types.VOID;
  5065. } else if (this.isVariableType(token)) {
  5066. this.pos++;
  5067. switch (token.type) {
  5068. case this.lexerClass.RK_INTEGER:
  5069. return _types.Types.INTEGER;
  5070. case this.lexerClass.RK_BOOLEAN:
  5071. return _types.Types.BOOLEAN;
  5072. case this.lexerClass.RK_REAL:
  5073. return _types.Types.REAL;
  5074. case this.lexerClass.RK_STRING:
  5075. return _types.Types.STRING;
  5076. default:
  5077. break;
  5078. }
  5079. }
  5080. throw _syntaxErrorFactory.SyntaxErrorFactory.invalid_type(this.getTypeArray(), token);
  5081. }
  5082. }, {
  5083. key: 'parseCommandBlock',
  5084. value: function parseCommandBlock() {
  5085. var optionalCurly = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  5086. var variablesDecl = [];
  5087. var commands = [];
  5088. var hasOpen = false;
  5089. if (this.checkOpenCurly(optionalCurly)) {
  5090. this.pos++;
  5091. hasOpen = true;
  5092. }
  5093. this.consumeNewLines();
  5094. while (true) {
  5095. var cmd = this.parseCommand();
  5096. if (cmd === null) break;
  5097. if (cmd !== -1) {
  5098. if (cmd instanceof Array) {
  5099. variablesDecl = variablesDecl.concat(cmd);
  5100. } else {
  5101. commands.push(cmd);
  5102. }
  5103. }
  5104. }
  5105. this.consumeNewLines();
  5106. if (hasOpen) {
  5107. this.checkCloseCurly();
  5108. this.pos++;
  5109. this.consumeNewLines();
  5110. }
  5111. return new Commands.CommandBlock(variablesDecl, commands);
  5112. }
  5113. }, {
  5114. key: 'parseCommand',
  5115. value: function parseCommand() {
  5116. var token = this.getToken();
  5117. if (this.isVariableType(token)) {
  5118. if (!this.insideScope(IVProgParser.FUNCTION)) {
  5119. throw _syntaxErrorFactory.SyntaxErrorFactory.invalid_var_declaration(token.line);
  5120. }
  5121. this.pushScope(IVProgParser.BASE);
  5122. var varType = this.parseType();
  5123. this.popScope();
  5124. var cmd = this.parseDeclaration(varType);
  5125. this.checkEOS();
  5126. this.pos++;
  5127. return cmd;
  5128. } else if (token.type === this.lexerClass.ID) {
  5129. return this.parseIDCommand();
  5130. } else if (token.type === this.lexerClass.LIB_ID) {
  5131. return this.parseIDCommand();
  5132. } else if (token.type === this.lexerClass.RK_RETURN) {
  5133. return this.parseReturn();
  5134. } else if (token.type === this.lexerClass.RK_WHILE) {
  5135. return this.parseWhile();
  5136. } else if (token.type === this.lexerClass.RK_FOR) {
  5137. return this.parseFor();
  5138. } else if (token.type === this.lexerClass.RK_BREAK) {
  5139. if (!this.insideScope(IVProgParser.BREAKABLE)) {
  5140. throw _syntaxErrorFactory.SyntaxErrorFactory.invalid_break_command(this.lexer.literalNames[this.lexerClass.RK_BREAK], token);
  5141. }
  5142. return this.parseBreak();
  5143. } else if (token.type === this.lexerClass.RK_SWITCH) {
  5144. return this.parseSwitchCase();
  5145. } else if (token.type === this.lexerClass.RK_DO) {
  5146. return this.parseDoWhile();
  5147. } else if (token.type === this.lexerClass.RK_IF) {
  5148. return this.parseIfThenElse();
  5149. } else if (this.checkEOS(true)) {
  5150. this.pos++;
  5151. return -1;
  5152. } else {
  5153. return null;
  5154. }
  5155. }
  5156. }, {
  5157. key: 'parseSwitchCase',
  5158. value: function parseSwitchCase() {
  5159. this.pushScope(IVProgParser.BREAKABLE);
  5160. this.pos++;
  5161. this.checkOpenParenthesis();
  5162. this.pos++;
  5163. this.consumeNewLines();
  5164. var exp = this.parseExpressionOR();
  5165. this.consumeNewLines();
  5166. this.checkCloseParenthesis();
  5167. this.pos++;
  5168. this.consumeNewLines();
  5169. this.checkOpenCurly();
  5170. this.pos++;
  5171. this.consumeNewLines();
  5172. var casesList = this.parseCases();
  5173. this.consumeNewLines();
  5174. this.checkCloseCurly();
  5175. this.pos++;
  5176. this.consumeNewLines();
  5177. this.popScope();
  5178. return new Commands.Switch(exp, casesList);
  5179. }
  5180. }, {
  5181. key: 'parseDoWhile',
  5182. value: function parseDoWhile() {
  5183. this.pos++;
  5184. this.consumeNewLines();
  5185. this.pushScope(IVProgParser.BREAKABLE);
  5186. var commandsBlock = this.parseCommandBlock();
  5187. this.consumeNewLines(); //Maybe not...
  5188. var whileToken = this.getToken();
  5189. if (whileToken.type !== this.lexerClass.RK_WHILE) {
  5190. throw _syntaxErrorFactory.SyntaxErrorFactory.token_missing_one(this.lexer.literalNames[this.lexerClass.RK_WHILE], whileToken);
  5191. }
  5192. this.pos++;
  5193. this.checkOpenParenthesis();
  5194. this.pos++;
  5195. this.consumeNewLines();
  5196. var condition = this.parseExpressionOR();
  5197. this.consumeNewLines();
  5198. this.checkCloseParenthesis();
  5199. this.pos++;
  5200. this.checkEOS();
  5201. this.popScope();
  5202. return new Commands.DoWhile(condition, commandsBlock);
  5203. }
  5204. }, {
  5205. key: 'parseIfThenElse',
  5206. value: function parseIfThenElse() {
  5207. if (this.insideScope(IVProgParser.BREAKABLE)) {
  5208. this.pushScope(IVProgParser.BREAKABLE);
  5209. } else {
  5210. this.pushScope(IVProgParser.COMMAND);
  5211. }
  5212. this.pos++;
  5213. this.checkOpenParenthesis();
  5214. this.pos++;
  5215. this.consumeNewLines();
  5216. var logicalExpression = this.parseExpressionOR();
  5217. this.consumeNewLines();
  5218. this.checkCloseParenthesis();
  5219. this.pos++;
  5220. this.consumeNewLines();
  5221. var cmdBlocks = this.parseCommandBlock();
  5222. var maybeElse = this.getToken();
  5223. if (maybeElse.type === this.lexerClass.RK_ELSE) {
  5224. this.pos++;
  5225. this.consumeNewLines();
  5226. var maybeIf = this.getToken();
  5227. var elseBlock = null;
  5228. if (this.checkOpenCurly(true)) {
  5229. elseBlock = this.parseCommandBlock();
  5230. } else if (maybeIf.type === this.lexerClass.RK_IF) {
  5231. elseBlock = this.parseIfThenElse();
  5232. } else {
  5233. throw _syntaxErrorFactory.SyntaxErrorFactory.token_missing_list([this.lexer.literalNames[this.lexerClass.RK_IF], '{'], maybeIf);
  5234. }
  5235. return new Commands.IfThenElse(logicalExpression, cmdBlocks, elseBlock);
  5236. }
  5237. this.popScope();
  5238. return new Commands.IfThenElse(logicalExpression, cmdBlocks, null);
  5239. }
  5240. }, {
  5241. key: 'parseFor',
  5242. value: function parseFor() {
  5243. this.pushScope(IVProgParser.BREAKABLE);
  5244. this.pos++;
  5245. this.checkOpenParenthesis();
  5246. this.pos++;
  5247. this.consumeNewLines();
  5248. var attribution = this.parseForAssign();
  5249. this.consumeNewLines();
  5250. var condition = this.parseExpressionOR();
  5251. this.consumeForSemiColon();
  5252. var increment = this.parseForAssign(true);
  5253. this.checkCloseParenthesis();
  5254. this.pos++;
  5255. this.consumeNewLines();
  5256. var commandsBlock = this.parseCommandBlock();
  5257. this.popScope();
  5258. return new Commands.For(attribution, condition, increment, commandsBlock);
  5259. }
  5260. }, {
  5261. key: 'parseWhile',
  5262. value: function parseWhile() {
  5263. this.pushScope(IVProgParser.BREAKABLE);
  5264. this.pos++;
  5265. this.checkOpenParenthesis();
  5266. this.pos++;
  5267. this.consumeNewLines();
  5268. var logicalExpression = this.parseExpressionOR();
  5269. this.consumeNewLines();
  5270. this.checkCloseParenthesis();
  5271. this.pos++;
  5272. this.consumeNewLines();
  5273. var cmdBlocks = this.parseCommandBlock();
  5274. this.popScope();
  5275. return new Commands.While(logicalExpression, cmdBlocks);
  5276. }
  5277. }, {
  5278. key: 'parseBreak',
  5279. value: function parseBreak() {
  5280. this.pos++;
  5281. this.checkEOS();
  5282. this.pos++;
  5283. return new Commands.Break();
  5284. }
  5285. }, {
  5286. key: 'parseReturn',
  5287. value: function parseReturn() {
  5288. this.pos++;
  5289. var exp = null;
  5290. if (!this.checkEOS(true)) {
  5291. exp = this.parseExpressionOR();
  5292. this.checkEOS();
  5293. }
  5294. this.pos++;
  5295. return new Commands.Return(exp);
  5296. }
  5297. }, {
  5298. key: 'parseIDCommand',
  5299. value: function parseIDCommand() {
  5300. var refToken = this.getToken();
  5301. var isID = refToken.type === this.lexerClass.ID;
  5302. var id = this.parseMaybeLibID();
  5303. if (this.checkOpenBrace(true)) {
  5304. this.pos++;
  5305. var lineExpression = null;
  5306. var columnExpression = null;
  5307. this.consumeNewLines();
  5308. lineExpression = this.parseExpression();
  5309. this.consumeNewLines();
  5310. this.checkCloseBrace();
  5311. this.pos++;
  5312. if (this.checkOpenBrace(true)) {
  5313. this.pos++;
  5314. this.consumeNewLines();
  5315. columnExpression = this.parseExpression();
  5316. this.consumeNewLines();
  5317. this.checkCloseBrace();
  5318. this.pos++;
  5319. }
  5320. var equalToken = this.getToken();
  5321. if (equalToken.type !== this.lexerClass.EQUAL) {
  5322. throw _syntaxErrorFactory.SyntaxErrorFactory.token_missing_one('=', equalToken);
  5323. }
  5324. this.pos++;
  5325. var exp = this.parseExpressionOR();
  5326. this.checkEOS();
  5327. this.pos++;
  5328. var cmd = new Commands.ArrayIndexAssign(id, lineExpression, columnExpression, exp);
  5329. cmd.sourceInfo = _sourceInfo2.SourceInfo.createSourceInfo(equalToken);
  5330. return cmd;
  5331. }
  5332. var equalOrParenthesis = this.getToken();
  5333. if (isID && equalOrParenthesis.type === this.lexerClass.EQUAL) {
  5334. this.pos++;
  5335. var _exp = this.parseExpressionOR();
  5336. this.checkEOS();
  5337. this.pos++;
  5338. var _cmd = new Commands.Assign(id, _exp);
  5339. _cmd.sourceInfo = _sourceInfo2.SourceInfo.createSourceInfo(equalOrParenthesis);
  5340. return _cmd;
  5341. } else if (equalOrParenthesis.type === this.lexerClass.OPEN_PARENTHESIS) {
  5342. var funcCall = this.parseFunctionCallCommand(id);
  5343. this.checkEOS();
  5344. this.pos++;
  5345. return funcCall;
  5346. } else if (isID) {
  5347. throw _syntaxErrorFactory.SyntaxErrorFactory.token_missing_list(['=', '('], equalOrParenthesis);
  5348. } else {
  5349. throw _syntaxErrorFactory.SyntaxErrorFactory.invalid_id_format(refToken);
  5350. }
  5351. }
  5352. }, {
  5353. key: 'parseForAssign',
  5354. value: function parseForAssign() {
  5355. var isLast = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  5356. if (!isLast) this.consumeNewLines();
  5357. if (this.checkEOS(true)) {
  5358. return null;
  5359. }
  5360. var id = this.parseID();
  5361. var equal = this.getToken();
  5362. if (equal.type !== this.lexerClass.EQUAL) {
  5363. throw _syntaxErrorFactory.SyntaxErrorFactory.token_missing_one('=', equal);
  5364. }
  5365. this.pos++;
  5366. var exp = this.parseExpressionOR();
  5367. if (!isLast) {
  5368. this.consumeForSemiColon();
  5369. }
  5370. var sourceInfo = _sourceInfo2.SourceInfo.createSourceInfo(equal);
  5371. var cmd = new Commands.Assign(id, exp);
  5372. cmd.sourceInfo = sourceInfo;
  5373. return cmd;
  5374. }
  5375. }, {
  5376. key: 'parseCases',
  5377. value: function parseCases() {
  5378. var token = this.getToken();
  5379. if (token.type !== this.lexerClass.RK_CASE) {
  5380. throw _syntaxErrorFactory.SyntaxErrorFactory.token_missing_one(this.lexer.literalNames[this.lexerClass.RK_CASE], token);
  5381. }
  5382. this.pos++;
  5383. var nextToken = this.getToken();
  5384. if (nextToken.type === this.lexerClass.RK_DEFAULT) {
  5385. this.pos++;
  5386. var colonToken = this.getToken();
  5387. if (colonToken.type !== this.lexerClass.COLON) {
  5388. throw _syntaxErrorFactory.SyntaxErrorFactory.token_missing_one(':', colonToken);
  5389. }
  5390. this.pos++;
  5391. this.consumeNewLines();
  5392. var block = this.parseCommandBlock(true);
  5393. var defaultCase = new Commands.Case(null);
  5394. defaultCase.setCommands(block.commands);
  5395. return [defaultCase];
  5396. } else {
  5397. var exp = this.parseExpressionOR();
  5398. var _colonToken = this.getToken();
  5399. if (_colonToken.type !== this.lexerClass.COLON) {
  5400. throw _syntaxErrorFactory.SyntaxErrorFactory.token_missing_one(':', _colonToken);
  5401. }
  5402. this.pos++;
  5403. this.consumeNewLines();
  5404. var _block = this.parseCommandBlock(true);
  5405. var aCase = new Commands.Case(exp);
  5406. aCase.setCommands(_block.commands);
  5407. var caseToken = this.getToken();
  5408. if (caseToken.type === this.lexerClass.RK_CASE) {
  5409. return [aCase].concat(this.parseCases());
  5410. } else {
  5411. return [aCase];
  5412. }
  5413. }
  5414. }
  5415. /*
  5416. * Parses an Expression following the structure:
  5417. *
  5418. * EOR => EAnd ( 'or' EOR)? #expression and
  5419. *
  5420. * EOR => ENot ('and' EOR)? #expression or
  5421. *
  5422. * ENot => 'not'? ER #expression not
  5423. *
  5424. * ER => E ((>=, <=, ==, >, <) E)? #expression relational
  5425. *
  5426. * E => factor ((+, -) E)? #expression
  5427. *
  5428. * factor=> term ((*, /, %) factor)?
  5429. *
  5430. * term => literal || arrayAccess || FuncCall || ID || '('EAnd')'
  5431. **/
  5432. }, {
  5433. key: 'parseExpressionOR',
  5434. value: function parseExpressionOR() {
  5435. var exp1 = this.parseExpressionAND();
  5436. while (this.getToken().type === this.lexerClass.OR_OPERATOR) {
  5437. var opToken = this.getToken();
  5438. this.pos++;
  5439. var or = (0, _operators.convertFromString)('or');
  5440. this.consumeNewLines();
  5441. var exp2 = this.parseExpressionAND();
  5442. var _finalExp = new Expressions.InfixApp(or, exp1, exp2);
  5443. _finalExp.sourceInfo = _sourceInfo2.SourceInfo.createSourceInfo(opToken);
  5444. exp1 = _finalExp;
  5445. }
  5446. return exp1;
  5447. }
  5448. }, {
  5449. key: 'parseExpressionAND',
  5450. value: function parseExpressionAND() {
  5451. var exp1 = this.parseExpressionNot();
  5452. while (this.getToken().type === this.lexerClass.AND_OPERATOR) {
  5453. var opToken = this.getToken();
  5454. this.pos++;
  5455. var and = (0, _operators.convertFromString)('and');
  5456. this.consumeNewLines();
  5457. var exp2 = this.parseExpressionNot();
  5458. var _finalExp2 = new Expressions.InfixApp(and, exp1, exp2);
  5459. _finalExp2.sourceInfo = _sourceInfo2.SourceInfo.createSourceInfo(opToken);
  5460. exp1 = _finalExp2;
  5461. }
  5462. return exp1;
  5463. }
  5464. }, {
  5465. key: 'parseExpressionNot',
  5466. value: function parseExpressionNot() {
  5467. var maybeNotToken = this.getToken();
  5468. if (maybeNotToken.type === this.lexerClass.NOT_OPERATOR) {
  5469. var opToken = this.getToken();
  5470. this.pos++;
  5471. var not = (0, _operators.convertFromString)('not');
  5472. var exp1 = this.parseExpressionRel();
  5473. finalExp = new Expressions.UnaryApp(not, exp1);
  5474. finalExp.sourceInfo = _sourceInfo2.SourceInfo.createSourceInfo(opToken);
  5475. return finalExp;
  5476. } else {
  5477. return this.parseExpressionRel();
  5478. }
  5479. }
  5480. }, {
  5481. key: 'parseExpressionRel',
  5482. value: function parseExpressionRel() {
  5483. var exp1 = this.parseExpression();
  5484. while (this.getToken().type === this.lexerClass.RELATIONAL_OPERATOR) {
  5485. var relToken = this.getToken();
  5486. this.pos++;
  5487. var rel = (0, _operators.convertFromString)(relToken.text);
  5488. var exp2 = this.parseExpression();
  5489. var _finalExp3 = new Expressions.InfixApp(rel, exp1, exp2);
  5490. _finalExp3.sourceInfo = _sourceInfo2.SourceInfo.createSourceInfo(relToken);
  5491. exp1 = _finalExp3;
  5492. }
  5493. return exp1;
  5494. }
  5495. }, {
  5496. key: 'parseExpression',
  5497. value: function parseExpression() {
  5498. var factor = this.parseFactor();
  5499. while (this.getToken().type === this.lexerClass.SUM_OP) {
  5500. var sumOpToken = this.getToken();
  5501. this.pos++;
  5502. var op = (0, _operators.convertFromString)(sumOpToken.text);
  5503. var factor2 = this.parseFactor();
  5504. var _finalExp4 = new Expressions.InfixApp(op, factor, factor2);
  5505. _finalExp4.sourceInfo = _sourceInfo2.SourceInfo.createSourceInfo(sumOpToken);
  5506. factor = _finalExp4;
  5507. }
  5508. return factor;
  5509. }
  5510. }, {
  5511. key: 'parseFactor',
  5512. value: function parseFactor() {
  5513. var term = this.parseTerm();
  5514. while (this.getToken().type === this.lexerClass.MULTI_OP) {
  5515. var multOpToken = this.getToken();
  5516. this.pos++;
  5517. var op = (0, _operators.convertFromString)(multOpToken.text);
  5518. var term2 = this.parseTerm();
  5519. var _finalExp5 = new Expressions.InfixApp(op, term, term2);
  5520. _finalExp5.sourceInfo = _sourceInfo2.SourceInfo.createSourceInfo(multOpToken);
  5521. term = _finalExp5;
  5522. }
  5523. return term;
  5524. }
  5525. }, {
  5526. key: 'parseTerm',
  5527. value: function parseTerm() {
  5528. var token = this.getToken();
  5529. var sourceInfo = null;
  5530. switch (token.type) {
  5531. case this.lexerClass.SUM_OP:
  5532. this.pos++;
  5533. sourceInfo = _sourceInfo2.SourceInfo.createSourceInfo(token);
  5534. var exp = new Expressions.UnaryApp((0, _operators.convertFromString)(token.text), this.parseTerm());
  5535. exp.sourceInfo = sourceInfo;
  5536. return exp;
  5537. case this.lexerClass.INTEGER:
  5538. this.pos++;
  5539. return this.getIntLiteral(token);
  5540. case this.lexerClass.REAL:
  5541. this.pos++;
  5542. return this.getRealLiteral(token);
  5543. case this.lexerClass.STRING:
  5544. this.pos++;
  5545. return this.getStringLiteral(token);
  5546. case this.lexerClass.RK_TRUE:
  5547. case this.lexerClass.RK_FALSE:
  5548. this.pos++;
  5549. return this.getBoolLiteral(token);
  5550. case this.lexerClass.OPEN_CURLY:
  5551. return this.parseArrayLiteral();
  5552. case this.lexerClass.ID:
  5553. case this.lexerClass.LIB_ID:
  5554. return this.parseIDTerm();
  5555. case this.lexerClass.OPEN_PARENTHESIS:
  5556. return this.parseParenthesisExp();
  5557. default:
  5558. throw _syntaxErrorFactory.SyntaxErrorFactory.invalid_terminal(token);
  5559. }
  5560. }
  5561. }, {
  5562. key: 'parseIDTerm',
  5563. value: function parseIDTerm() {
  5564. var tokenA = this.getToken();
  5565. var id = this.parseMaybeLibID();
  5566. var isID = tokenA.type === this.lexerClass.ID;
  5567. if (isID && this.checkOpenBrace(true)) {
  5568. var tokenB = null;
  5569. this.pos++;
  5570. var firstIndex = this.parseExpression();
  5571. var secondIndex = null;
  5572. this.consumeNewLines();
  5573. this.checkCloseBrace();
  5574. tokenB = this.getToken();
  5575. this.pos++;
  5576. if (this.checkOpenBrace(true)) {
  5577. this.pos++;
  5578. secondIndex = this.parseExpression();
  5579. this.consumeNewLines();
  5580. this.checkCloseBrace();
  5581. tokenB = this.getToken();
  5582. this.pos++;
  5583. }
  5584. var sourceInfo = _sourceInfo2.SourceInfo.createSourceInfoFromList(tokenA, tokenB);
  5585. var exp = new Expressions.ArrayAccess(id, firstIndex, secondIndex);
  5586. exp.sourceInfo = sourceInfo;
  5587. return exp;
  5588. } else if (this.checkOpenParenthesis(true)) {
  5589. return this.parseFunctionCallExpression(id);
  5590. } else if (isID) {
  5591. var _sourceInfo = _sourceInfo2.SourceInfo.createSourceInfo(tokenA);
  5592. var _exp2 = new Expressions.VariableLiteral(id);
  5593. _exp2.sourceInfo = _sourceInfo;
  5594. return _exp2;
  5595. } else {
  5596. throw _syntaxErrorFactory.SyntaxErrorFactory.invalid_id_format(tokenA);
  5597. }
  5598. }
  5599. }, {
  5600. key: 'getFunctionName',
  5601. value: function getFunctionName(id) {
  5602. var name = _definedFunctions.LanguageDefinedFunction.getInternalName(id);
  5603. if (name === null) {
  5604. if (id === _definedFunctions.LanguageDefinedFunction.getMainFunctionName()) {
  5605. return null;
  5606. }
  5607. return id;
  5608. } else {
  5609. return name;
  5610. }
  5611. }
  5612. }, {
  5613. key: 'parseFunctionCallExpression',
  5614. value: function parseFunctionCallExpression(id) {
  5615. var tokenA = this.getToken(this.pos - 1);
  5616. var actualParameters = this.parseActualParameters();
  5617. var tokenB = this.getToken(this.pos - 1);
  5618. var funcName = this.getFunctionName(id);
  5619. var sourceInfo = _sourceInfo2.SourceInfo.createSourceInfoFromList(tokenA, tokenB);
  5620. var cmd = new Expressions.FunctionCall(funcName, actualParameters);
  5621. cmd.sourceInfo = sourceInfo;
  5622. return cmd;
  5623. }
  5624. }, {
  5625. key: 'parseFunctionCallCommand',
  5626. value: function parseFunctionCallCommand(id) {
  5627. return this.parseFunctionCallExpression(id);
  5628. }
  5629. }, {
  5630. key: 'parseParenthesisExp',
  5631. value: function parseParenthesisExp() {
  5632. this.checkOpenParenthesis();
  5633. var tokenA = this.getToken();
  5634. this.pos++;
  5635. this.consumeNewLines();
  5636. var exp = this.parseExpressionOR();
  5637. this.consumeNewLines();
  5638. this.checkCloseParenthesis();
  5639. var tokenB = this.getToken();
  5640. var sourceInfo = _sourceInfo2.SourceInfo.createSourceInfoFromList(tokenA, tokenB);
  5641. this.pos++;
  5642. exp.sourceInfo = sourceInfo;
  5643. return exp;
  5644. }
  5645. }, {
  5646. key: 'parseActualParameters',
  5647. value: function parseActualParameters() {
  5648. this.checkOpenParenthesis();
  5649. this.pos++;
  5650. if (this.checkCloseParenthesis(true)) {
  5651. this.pos++;
  5652. return [];
  5653. }
  5654. this.consumeNewLines();
  5655. var list = this.parseExpressionList();
  5656. this.consumeNewLines();
  5657. this.checkCloseParenthesis();
  5658. this.pos++;
  5659. return list;
  5660. }
  5661. }, {
  5662. key: 'parseExpressionList',
  5663. value: function parseExpressionList() {
  5664. var list = [];
  5665. while (true) {
  5666. var exp = this.parseExpressionOR();
  5667. list.push(exp);
  5668. var maybeToken = this.getToken();
  5669. if (maybeToken.type !== this.lexerClass.COMMA) {
  5670. break;
  5671. } else {
  5672. this.pos++;
  5673. this.consumeNewLines();
  5674. }
  5675. }
  5676. return list;
  5677. }
  5678. }, {
  5679. key: 'getTypeArray',
  5680. value: function getTypeArray() {
  5681. var _this = this;
  5682. var types = this.insideScope(IVProgParser.FUNCTION) ? this.functionTypes : this.variableTypes;
  5683. return types.map(function (x) {
  5684. return _this.lexer.literalNames[x];
  5685. });
  5686. }
  5687. }]);
  5688. return IVProgParser;
  5689. }();
  5690. /***/ }),
  5691. /***/ "./js/ast/operators.js":
  5692. /*!*****************************!*\
  5693. !*** ./js/ast/operators.js ***!
  5694. \*****************************/
  5695. /*! no static exports found */
  5696. /***/ (function(module, exports, __webpack_require__) {
  5697. "use strict";
  5698. Object.defineProperty(exports, "__esModule", {
  5699. value: true
  5700. });
  5701. exports.convertFromString = convertFromString;
  5702. var Operators = exports.Operators = Object.freeze({
  5703. ADD: { ord: 0, value: "+" },
  5704. SUB: { ord: 1, value: "-" },
  5705. MULT: { ord: 2, value: '*' },
  5706. DIV: { ord: 3, value: '/' },
  5707. MOD: { ord: 4, value: '%' },
  5708. GT: { ord: 5, value: '>' },
  5709. GE: { ord: 6, value: '>=' },
  5710. LT: { ord: 7, value: '<' },
  5711. LE: { ord: 8, value: '<=' },
  5712. EQ: { ord: 9, value: '==' },
  5713. NEQ: { ord: 10, value: '!=' },
  5714. AND: { ord: 11, value: 'and' },
  5715. OR: { ord: 12, value: 'or' },
  5716. NOT: { ord: 13, value: 'not' }
  5717. });
  5718. function convertFromString(op) {
  5719. switch (op) {
  5720. case '+':
  5721. return Operators.ADD;
  5722. case '-':
  5723. return Operators.SUB;
  5724. case '*':
  5725. return Operators.MULT;
  5726. case '/':
  5727. return Operators.DIV;
  5728. case '%':
  5729. return Operators.MOD;
  5730. case '>':
  5731. return Operators.GT;
  5732. case '>=':
  5733. return Operators.GE;
  5734. case '<':
  5735. return Operators.LT;
  5736. case '<=':
  5737. return Operators.LE;
  5738. case '==':
  5739. return Operators.EQ;
  5740. case '!=':
  5741. return Operators.NEQ;
  5742. case 'and':
  5743. return Operators.AND;
  5744. case 'or':
  5745. return Operators.OR;
  5746. case 'not':
  5747. return Operators.NOT;
  5748. }
  5749. }
  5750. /***/ }),
  5751. /***/ "./js/ast/sourceInfo.js":
  5752. /*!******************************!*\
  5753. !*** ./js/ast/sourceInfo.js ***!
  5754. \******************************/
  5755. /*! no static exports found */
  5756. /***/ (function(module, exports, __webpack_require__) {
  5757. "use strict";
  5758. Object.defineProperty(exports, "__esModule", {
  5759. value: true
  5760. });
  5761. 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; }; }();
  5762. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  5763. var SourceInfo = exports.SourceInfo = function () {
  5764. _createClass(SourceInfo, null, [{
  5765. key: "createSourceInfo",
  5766. value: function createSourceInfo(token) {
  5767. return new SourceInfo(token.line, token.column, token.text.length);
  5768. }
  5769. }, {
  5770. key: "createSourceInfoFromList",
  5771. value: function createSourceInfoFromList(tokenA, tokenB) {
  5772. var line = tokenA.line;
  5773. var column = tokenA.column;
  5774. // copied from https://github.com/UNIVALI-LITE/Portugol-Studio/blob/master/core/src/main/java/br/univali/portugol/nucleo/analise/sintatica/Portugol.g
  5775. // No idea why...
  5776. var size = tokenB.tokenIndex + 1 - tokenA.tokenIndex;
  5777. return new SourceInfo(line, column, size);
  5778. }
  5779. }]);
  5780. function SourceInfo(line, column, size) {
  5781. _classCallCheck(this, SourceInfo);
  5782. this.line = line;
  5783. this.column = column;
  5784. this.size = size;
  5785. }
  5786. return SourceInfo;
  5787. }();
  5788. /***/ }),
  5789. /***/ "./js/io/domConsole.js":
  5790. /*!*****************************!*\
  5791. !*** ./js/io/domConsole.js ***!
  5792. \*****************************/
  5793. /*! no static exports found */
  5794. /***/ (function(module, exports, __webpack_require__) {
  5795. "use strict";
  5796. Object.defineProperty(exports, "__esModule", {
  5797. value: true
  5798. });
  5799. exports.DOMConsole = undefined;
  5800. 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; }; }();
  5801. var _jquery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  5802. var _jquery2 = _interopRequireDefault(_jquery);
  5803. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  5804. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  5805. var DOMConsole = exports.DOMConsole = function () {
  5806. _createClass(DOMConsole, null, [{
  5807. key: 'USER',
  5808. get: function get() {
  5809. return 0;
  5810. }
  5811. }, {
  5812. key: 'INFO',
  5813. get: function get() {
  5814. return 1;
  5815. }
  5816. }, {
  5817. key: 'ERR',
  5818. get: function get() {
  5819. return 2;
  5820. }
  5821. }]);
  5822. function DOMConsole(elementID) {
  5823. _classCallCheck(this, DOMConsole);
  5824. this.input = null;
  5825. this.needInput = false;
  5826. this.termDiv = null;
  5827. this.anyKey = false;
  5828. this.parent = (0, _jquery2.default)(elementID);
  5829. this.setup();
  5830. this.inputListeners = [];
  5831. }
  5832. _createClass(DOMConsole, [{
  5833. key: 'setup',
  5834. value: function setup() {
  5835. this._setupDom();
  5836. this._setupEvents();
  5837. }
  5838. }, {
  5839. key: '_setupEvents',
  5840. value: function _setupEvents() {
  5841. var _this = this;
  5842. this.input.on("keydown", function (event) {
  5843. if (!_this.needInput) {
  5844. event.preventDefault();
  5845. return;
  5846. }
  5847. var keyCode = event.which;
  5848. if (keyCode === 13 || _this.anyKey) {
  5849. var text = _this.input.val();
  5850. text = text.replace('[\n\r]+', '');
  5851. _this.notifyListeners(text);
  5852. _this.write(text);
  5853. _this.input.val("");
  5854. }
  5855. });
  5856. }
  5857. }, {
  5858. key: '_setupDom',
  5859. value: function _setupDom() {
  5860. this.termDiv = (0, _jquery2.default)("<div></div>");
  5861. this.termDiv.addClass("ivprog-term-div");
  5862. this.input = (0, _jquery2.default)('<input text="type">');
  5863. this.input.addClass("ivprog-term-input");
  5864. this.termDiv.append(this.input);
  5865. this.parent.append(this.termDiv);
  5866. }
  5867. }, {
  5868. key: 'notifyListeners',
  5869. value: function notifyListeners(text) {
  5870. this.inputListeners.forEach(function (resolve) {
  5871. return resolve(text);
  5872. });
  5873. this.inputListeners.splice(0, this.inputListeners.length);
  5874. this.hideInput();
  5875. this.anyKey = false;
  5876. }
  5877. }, {
  5878. key: 'write',
  5879. value: function write(text) {
  5880. this._appendText(text, DOMConsole.USER);
  5881. }
  5882. }, {
  5883. key: 'info',
  5884. value: function info(text) {
  5885. this._appendText(text, DOMConsole.INFO);
  5886. }
  5887. }, {
  5888. key: 'err',
  5889. value: function err(text) {
  5890. this._appendText(text, DOMConsole.ERR);
  5891. }
  5892. }, {
  5893. key: '_appendText',
  5894. value: function _appendText(text, type) {
  5895. var divClass = this.getClassForType(type);
  5896. var textDiv = (0, _jquery2.default)("<div></div>");
  5897. textDiv.addClass(divClass);
  5898. textDiv.append(text);
  5899. textDiv.insertBefore(this.input);
  5900. this.scrollTerm();
  5901. }
  5902. }, {
  5903. key: 'scrollTerm',
  5904. value: function scrollTerm() {
  5905. this.termDiv.animate({
  5906. scrollTop: this.termDiv.prop('scrollHeight')
  5907. }, 0);
  5908. }
  5909. }, {
  5910. key: 'getClassForType',
  5911. value: function getClassForType(type) {
  5912. switch (type) {
  5913. case DOMConsole.USER:
  5914. return "ivprog-term-userText";
  5915. case DOMConsole.INFO:
  5916. return "ivprog-term-info";
  5917. case DOMConsole.ERR:
  5918. return "ivprog-term-error";
  5919. }
  5920. }
  5921. }, {
  5922. key: 'dispose',
  5923. value: function dispose() {
  5924. this.parent.off();
  5925. this.input.off();
  5926. this.input = null;
  5927. this.parent.empty();
  5928. }
  5929. }, {
  5930. key: 'showInput',
  5931. value: function showInput() {
  5932. this.needInput = true;
  5933. this.input.show();
  5934. this.input.focus();
  5935. }
  5936. }, {
  5937. key: 'hideInput',
  5938. value: function hideInput() {
  5939. this.needInput = false;
  5940. this.input.hide();
  5941. }
  5942. }, {
  5943. key: 'requestInput',
  5944. value: function requestInput(callback) {
  5945. var anyKey = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  5946. this.inputListeners.push(callback);
  5947. this.anyKey = anyKey;
  5948. this.showInput();
  5949. }
  5950. }, {
  5951. key: 'sendOutput',
  5952. value: function sendOutput(text) {
  5953. var _this2 = this;
  5954. var output = "" + text;
  5955. output.split("\n").forEach(function (t) {
  5956. t = t.replace(/\t/g, '&#9;');
  5957. _this2.write(t);
  5958. });
  5959. }
  5960. }, {
  5961. key: 'clear',
  5962. value: function clear() {
  5963. this.input.parent().children().not(this.input).remove();
  5964. this.input.val("");
  5965. }
  5966. }]);
  5967. return DOMConsole;
  5968. }();
  5969. /***/ }),
  5970. /***/ "./js/io/input.js":
  5971. /*!************************!*\
  5972. !*** ./js/io/input.js ***!
  5973. \************************/
  5974. /*! no static exports found */
  5975. /***/ (function(module, exports, __webpack_require__) {
  5976. "use strict";
  5977. Object.defineProperty(exports, "__esModule", {
  5978. value: true
  5979. });
  5980. 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; }; }();
  5981. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  5982. var Input = exports.Input = function () {
  5983. function Input() {
  5984. _classCallCheck(this, Input);
  5985. }
  5986. _createClass(Input, [{
  5987. key: "requestInput",
  5988. value: function requestInput(callback) {
  5989. throw new Error("Must be implemented");
  5990. }
  5991. }]);
  5992. return Input;
  5993. }();
  5994. /***/ }),
  5995. /***/ "./js/io/output.js":
  5996. /*!*************************!*\
  5997. !*** ./js/io/output.js ***!
  5998. \*************************/
  5999. /*! no static exports found */
  6000. /***/ (function(module, exports, __webpack_require__) {
  6001. "use strict";
  6002. Object.defineProperty(exports, "__esModule", {
  6003. value: true
  6004. });
  6005. 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; }; }();
  6006. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  6007. var Output = exports.Output = function () {
  6008. function Output() {
  6009. _classCallCheck(this, Output);
  6010. }
  6011. _createClass(Output, [{
  6012. key: "sendOutput",
  6013. value: function sendOutput(text) {
  6014. throw new Error("Must be implemented");
  6015. }
  6016. }]);
  6017. return Output;
  6018. }();
  6019. /***/ }),
  6020. /***/ "./js/main.js":
  6021. /*!********************!*\
  6022. !*** ./js/main.js ***!
  6023. \********************/
  6024. /*! no static exports found */
  6025. /***/ (function(module, exports, __webpack_require__) {
  6026. "use strict";
  6027. Object.defineProperty(exports, "__esModule", {
  6028. value: true
  6029. });
  6030. exports.i18n = exports.LocalizedStrings = exports.initVisualUI = exports.runner = undefined;
  6031. var _runner = __webpack_require__(/*! ./runner */ "./js/runner.js");
  6032. var _functions = __webpack_require__(/*! ./visualUI/functions */ "./js/visualUI/functions.js");
  6033. var _localizedStringsService = __webpack_require__(/*! ./services/localizedStringsService */ "./js/services/localizedStringsService.js");
  6034. var _i18nHelper = __webpack_require__(/*! ./services/i18nHelper */ "./js/services/i18nHelper.js");
  6035. var i18n = _i18nHelper.i18nHelper.i18n;
  6036. exports.runner = _runner.runner;
  6037. exports.initVisualUI = _functions.initVisualUI;
  6038. exports.LocalizedStrings = _localizedStringsService.LocalizedStrings;
  6039. exports.i18n = i18n;
  6040. /***/ }),
  6041. /***/ "./js/processor/compatibilityTable.js":
  6042. /*!********************************************!*\
  6043. !*** ./js/processor/compatibilityTable.js ***!
  6044. \********************************************/
  6045. /*! no static exports found */
  6046. /***/ (function(module, exports, __webpack_require__) {
  6047. "use strict";
  6048. Object.defineProperty(exports, "__esModule", {
  6049. value: true
  6050. });
  6051. exports.resultTypeAfterInfixOp = resultTypeAfterInfixOp;
  6052. exports.resultTypeAfterUnaryOp = resultTypeAfterUnaryOp;
  6053. var _types = __webpack_require__(/*! ./../typeSystem/types */ "./js/typeSystem/types.js");
  6054. var _operators = __webpack_require__(/*! ./../ast/operators */ "./js/ast/operators.js");
  6055. var _multiType = __webpack_require__(/*! ../typeSystem/multiType */ "./js/typeSystem/multiType.js");
  6056. var _config = __webpack_require__(/*! ../util/config */ "./js/util/config.js");
  6057. function buildInfixAddTable() {
  6058. var table = [[], [], [], []];
  6059. table[_types.Types.INTEGER.ord][_types.Types.INTEGER.ord] = _types.Types.INTEGER;
  6060. table[_types.Types.INTEGER.ord][_types.Types.REAL.ord] = _types.Types.REAL;
  6061. table[_types.Types.INTEGER.ord][_types.Types.STRING.ord] = _types.Types.STRING;
  6062. table[_types.Types.REAL.ord][_types.Types.INTEGER.ord] = _types.Types.REAL;
  6063. table[_types.Types.REAL.ord][_types.Types.REAL.ord] = _types.Types.REAL;
  6064. table[_types.Types.REAL.ord][_types.Types.STRING.ord] = _types.Types.STRING;
  6065. table[_types.Types.STRING.ord][_types.Types.INTEGER.ord] = _types.Types.STRING;
  6066. table[_types.Types.STRING.ord][_types.Types.REAL.ord] = _types.Types.STRING;
  6067. table[_types.Types.STRING.ord][_types.Types.STRING.ord] = _types.Types.STRING;
  6068. table[_types.Types.STRING.ord][_types.Types.BOOLEAN.ord] = _types.Types.STRING;
  6069. return table;
  6070. }
  6071. function buildInfixMultiDivSubTable() {
  6072. var table = [[], [], [], []];
  6073. table[_types.Types.INTEGER.ord][_types.Types.INTEGER.ord] = _types.Types.INTEGER;
  6074. table[_types.Types.INTEGER.ord][_types.Types.REAL.ord] = _types.Types.REAL;
  6075. table[_types.Types.REAL.ord][_types.Types.INTEGER.ord] = _types.Types.REAL;
  6076. table[_types.Types.REAL.ord][_types.Types.REAL.ord] = _types.Types.REAL;
  6077. return table;
  6078. }
  6079. function buildInfixEqualityInequalityTable() {
  6080. var table = [[], [], [], []];
  6081. table[_types.Types.INTEGER.ord][_types.Types.INTEGER.ord] = _types.Types.BOOLEAN;
  6082. table[_types.Types.REAL.ord][_types.Types.REAL.ord] = _types.Types.BOOLEAN;
  6083. table[_types.Types.BOOLEAN.ord][_types.Types.BOOLEAN.ord] = _types.Types.BOOLEAN;
  6084. table[_types.Types.STRING.ord][_types.Types.STRING.ord] = _types.Types.BOOLEAN;
  6085. return table;
  6086. }
  6087. function buildInfixRelationalTable() {
  6088. var table = [[], [], [], []];
  6089. table[_types.Types.INTEGER.ord][_types.Types.INTEGER.ord] = _types.Types.BOOLEAN;
  6090. table[_types.Types.REAL.ord][_types.Types.REAL.ord] = _types.Types.BOOLEAN;
  6091. table[_types.Types.STRING.ord][_types.Types.STRING.ord] = _types.Types.BOOLEAN;
  6092. return table;
  6093. }
  6094. function buildInfixAndOrTable() {
  6095. var table = [[], [], [], []];
  6096. table[_types.Types.BOOLEAN.ord][_types.Types.BOOLEAN.ord] = _types.Types.BOOLEAN;
  6097. return table;
  6098. }
  6099. function buildInfixModTable() {
  6100. var table = [[], [], [], []];
  6101. table[_types.Types.INTEGER.ord][_types.Types.INTEGER.ord] = _types.Types.INTEGER;
  6102. return table;
  6103. }
  6104. function buildUnarySumSubList() {
  6105. var list = [];
  6106. list[_types.Types.INTEGER.ord] = _types.Types.INTEGER;
  6107. list[_types.Types.REAL.ord] = _types.Types.REAL;
  6108. return list;
  6109. }
  6110. function buildUnaryNegList() {
  6111. var list = [];
  6112. list[_types.Types.BOOLEAN.ord] = _types.Types.BOOLEAN;
  6113. return list;
  6114. }
  6115. function buildInfixCompatibilityTable() {
  6116. var compatibilityMap = new WeakMap();
  6117. compatibilityMap.set(_operators.Operators.ADD, buildInfixAddTable());
  6118. compatibilityMap.set(_operators.Operators.SUB, buildInfixMultiDivSubTable());
  6119. compatibilityMap.set(_operators.Operators.MULT, buildInfixMultiDivSubTable());
  6120. compatibilityMap.set(_operators.Operators.DIV, buildInfixMultiDivSubTable());
  6121. compatibilityMap.set(_operators.Operators.EQ, buildInfixEqualityInequalityTable());
  6122. compatibilityMap.set(_operators.Operators.NEQ, buildInfixEqualityInequalityTable());
  6123. compatibilityMap.set(_operators.Operators.GE, buildInfixRelationalTable());
  6124. compatibilityMap.set(_operators.Operators.GT, buildInfixRelationalTable());
  6125. compatibilityMap.set(_operators.Operators.LE, buildInfixRelationalTable());
  6126. compatibilityMap.set(_operators.Operators.LT, buildInfixRelationalTable());
  6127. compatibilityMap.set(_operators.Operators.OR, buildInfixAndOrTable());
  6128. compatibilityMap.set(_operators.Operators.AND, buildInfixAndOrTable());
  6129. compatibilityMap.set(_operators.Operators.MOD, buildInfixModTable());
  6130. return compatibilityMap;
  6131. }
  6132. function buildUnaryCompatibilityTable() {
  6133. var compatibilityMap = new WeakMap();
  6134. compatibilityMap.set(_operators.Operators.ADD, buildUnarySumSubList());
  6135. compatibilityMap.set(_operators.Operators.SUB, buildUnarySumSubList());
  6136. compatibilityMap.set(_operators.Operators.NOT, buildUnaryNegList());
  6137. return compatibilityMap;
  6138. }
  6139. var infixMap = buildInfixCompatibilityTable();
  6140. var unaryMap = buildUnaryCompatibilityTable();
  6141. function resultTypeAfterInfixOp(operator, leftExpressionType, rightExpressionType) {
  6142. try {
  6143. if (leftExpressionType instanceof _multiType.MultiType && rightExpressionType instanceof _multiType.MultiType) {
  6144. var newMulti = [];
  6145. for (var i = 0; i < leftExpressionType.types.length; i++) {
  6146. var element = leftExpressionType.types[i];
  6147. if (rightExpressionType.types.indexOf(element) !== -1) {
  6148. newMulti.push(element);
  6149. }
  6150. }
  6151. if (newMulti.length <= 0) {
  6152. if (_config.Config.enable_type_casting) {
  6153. if (leftExpressionType.isCompatible(_types.Types.INTEGER) || leftExpressionType.isCompatible(_types.Types.REAL)) {
  6154. if (rightExpressionType.isCompatible(_types.Types.INTEGER) || rightExpressionType.isCompatible(_types.Types.REAL)) {
  6155. return new _multiType.MultiType([_types.Types.INTEGER, _types.Types.REAL]);
  6156. }
  6157. }
  6158. }
  6159. return _types.Types.UNDEFINED;
  6160. } else {
  6161. return new _multiType.MultiType(newMulti);
  6162. }
  6163. } else if (leftExpressionType instanceof _multiType.MultiType) {
  6164. if (leftExpressionType.isCompatible(rightExpressionType)) {
  6165. return rightExpressionType;
  6166. } else {
  6167. if (_config.Config.enable_type_casting) {
  6168. if (leftExpressionType.isCompatible(_types.Types.INTEGER) || leftExpressionType.isCompatible(_types.Types.REAL)) {
  6169. if (rightExpressionType.isCompatible(_types.Types.INTEGER) || rightExpressionType.isCompatible(_types.Types.REAL)) {
  6170. return rightExpressionType;
  6171. }
  6172. }
  6173. }
  6174. return _types.Types.UNDEFINED;
  6175. }
  6176. } else if (rightExpressionType instanceof _multiType.MultiType) {
  6177. if (rightExpressionType.isCompatible(leftExpressionType)) {
  6178. return leftExpressionType;
  6179. } else {
  6180. if (_config.Config.enable_type_casting) {
  6181. if (leftExpressionType.isCompatible(_types.Types.INTEGER) || leftExpressionType.isCompatible(_types.Types.REAL)) {
  6182. if (rightExpressionType.isCompatible(_types.Types.INTEGER) || rightExpressionType.isCompatible(_types.Types.REAL)) {
  6183. return leftExpressionType;
  6184. }
  6185. }
  6186. }
  6187. return _types.Types.UNDEFINED;
  6188. }
  6189. }
  6190. var resultType = infixMap.get(operator)[leftExpressionType.ord][rightExpressionType.ord];
  6191. if (resultType === null || resultType === undefined) {
  6192. if (_config.Config.enable_type_casting) {
  6193. if (leftExpressionType.isCompatible(_types.Types.INTEGER) || leftExpressionType.isCompatible(_types.Types.REAL)) {
  6194. if (rightExpressionType.isCompatible(_types.Types.INTEGER) || rightExpressionType.isCompatible(_types.Types.REAL)) {
  6195. if (operator === _operators.Operators.MOD) {
  6196. return _types.Types.INTEGER;
  6197. } else if (operator.ord >= 5 && operator.ord <= 10) {
  6198. return _types.Types.BOOLEAN;
  6199. }
  6200. }
  6201. }
  6202. }
  6203. return _types.Types.UNDEFINED;
  6204. }
  6205. return resultType;
  6206. } catch (e) {
  6207. if (e instanceof TypeError) {
  6208. return _types.Types.UNDEFINED;
  6209. } else {
  6210. throw e;
  6211. }
  6212. }
  6213. }
  6214. function resultTypeAfterUnaryOp(operator, leftExpressionType) {
  6215. try {
  6216. if (leftExpressionType instanceof _multiType.MultiType) {
  6217. return leftExpressionType;
  6218. }
  6219. return unaryMap.get(operator)[leftExpressionType.ord];
  6220. } catch (e) {
  6221. if (e instanceof TypeError) {
  6222. return _types.Types.UNDEFINED;
  6223. } else {
  6224. throw e;
  6225. }
  6226. }
  6227. }
  6228. /***/ }),
  6229. /***/ "./js/processor/context.js":
  6230. /*!*********************************!*\
  6231. !*** ./js/processor/context.js ***!
  6232. \*********************************/
  6233. /*! no static exports found */
  6234. /***/ (function(module, exports, __webpack_require__) {
  6235. "use strict";
  6236. Object.defineProperty(exports, "__esModule", {
  6237. value: true
  6238. });
  6239. var Context = exports.Context = Object.freeze({
  6240. BASE: Symbol('context:base'),
  6241. BREAKABLE: Symbol('context:breakable'),
  6242. FUNCTION: Symbol('context:function')
  6243. });
  6244. /***/ }),
  6245. /***/ "./js/processor/definedFunctions.js":
  6246. /*!******************************************!*\
  6247. !*** ./js/processor/definedFunctions.js ***!
  6248. \******************************************/
  6249. /*! no static exports found */
  6250. /***/ (function(module, exports, __webpack_require__) {
  6251. "use strict";
  6252. Object.defineProperty(exports, "__esModule", {
  6253. value: true
  6254. });
  6255. exports.LanguageDefinedFunction = undefined;
  6256. var _languageService = __webpack_require__(/*! ../services/languageService */ "./js/services/languageService.js");
  6257. var _io = __webpack_require__(/*! ./lib/io */ "./js/processor/lib/io.js");
  6258. var _strings = __webpack_require__(/*! ./lib/strings */ "./js/processor/lib/strings.js");
  6259. var _arrays = __webpack_require__(/*! ./lib/arrays */ "./js/processor/lib/arrays.js");
  6260. var _lang = __webpack_require__(/*! ./lib/lang */ "./js/processor/lib/lang.js");
  6261. var _math = __webpack_require__(/*! ./lib/math */ "./js/processor/lib/math.js");
  6262. function valueToKey(value, object) {
  6263. for (var key in object) {
  6264. if (object.hasOwnProperty(key)) {
  6265. if (object[key] === value) {
  6266. return key;
  6267. }
  6268. }
  6269. }
  6270. return null;
  6271. }
  6272. function concatObjects() {
  6273. var result = {};
  6274. for (var _len = arguments.length, objs = Array(_len), _key = 0; _key < _len; _key++) {
  6275. objs[_key] = arguments[_key];
  6276. }
  6277. for (var i = 0; i < objs.length; i++) {
  6278. var obj = objs[i];
  6279. for (var key in obj) {
  6280. if (obj.hasOwnProperty(key)) {
  6281. result[key] = obj[key];
  6282. }
  6283. }
  6284. }
  6285. return result;
  6286. }
  6287. var libsObject = {
  6288. $mathLib: {
  6289. $sin: (0, _math.createSinFun)(),
  6290. $cos: (0, _math.createCosFun)(),
  6291. $tan: (0, _math.createTanFun)(),
  6292. $sqrt: (0, _math.createSqrtFun)(),
  6293. $pow: (0, _math.createPowFun)(),
  6294. $log: (0, _math.createLogFun)(),
  6295. $abs: (0, _math.createAbsFun)(),
  6296. $negate: (0, _math.createNegateFun)(),
  6297. $invert: (0, _math.createInvertFun)(),
  6298. $max: (0, _math.createMaxFun)(),
  6299. $min: (0, _math.createMinFun)()
  6300. },
  6301. $ioLib: {
  6302. $read: (0, _io.createInputFun)(),
  6303. $write: (0, _io.createOutputFun)()
  6304. },
  6305. $strLib: {
  6306. $substring: (0, _strings.createSubstringFun)(),
  6307. $length: (0, _strings.createLengthFun)(),
  6308. $uppercase: (0, _strings.createUppercaseFun)(),
  6309. $lowercase: (0, _strings.createLowercaseFun)(),
  6310. $charAt: (0, _strings.createrCharAtFun)()
  6311. },
  6312. $arrayLib: {
  6313. $numElements: (0, _arrays.createNumElementsFun)(),
  6314. $matrixLines: (0, _arrays.createMatrixLinesFun)(),
  6315. $matrixColumns: (0, _arrays.createMatrixColumnsFun)()
  6316. },
  6317. $langLib: {
  6318. $isReal: (0, _lang.createIsRealFun)(),
  6319. $isInt: (0, _lang.createIsIntFun)(),
  6320. $isBool: (0, _lang.createIsBoolFun)(),
  6321. $castReal: (0, _lang.createCastRealFun)(),
  6322. $castInt: (0, _lang.createCastIntFun)(),
  6323. $castBool: (0, _lang.createCastBoolFun)(),
  6324. $castString: (0, _lang.createCastStringFun)()
  6325. }
  6326. };
  6327. var funcsObject = concatObjects(libsObject.$ioLib, libsObject.$langLib, libsObject.$strLib, libsObject.$arrayLib);
  6328. var LanguageDefinedFunction = exports.LanguageDefinedFunction = Object.freeze({
  6329. getMainFunctionName: function getMainFunctionName() {
  6330. return _languageService.LanguageService.getCurrentLangFuncs().main_function;
  6331. },
  6332. getInternalName: function getInternalName(localName) {
  6333. if (localName.indexOf(".") !== -1) {
  6334. var names = localName.split(".");
  6335. var lib = valueToKey(names[0], _languageService.LanguageService.getCurrentLangLibs());
  6336. var internalName = valueToKey(names[1], _languageService.LanguageService.getCurrentLangFuncs());
  6337. if (lib === null || internalName === null) {
  6338. return null;
  6339. }
  6340. return lib + "." + internalName;
  6341. }
  6342. var funcName = valueToKey(localName, _languageService.LanguageService.getCurrentLangFuncs());
  6343. if (funcName !== null) {
  6344. if (funcsObject[funcName]) {
  6345. return funcName;
  6346. }
  6347. }
  6348. return null;
  6349. },
  6350. getFunction: function getFunction(internalName) {
  6351. if (internalName.indexOf(".") !== -1) {
  6352. var names = internalName.split(".");
  6353. var libName = names[0];
  6354. var funName = names[1];
  6355. return libsObject[libName][funName];
  6356. }
  6357. return funcsObject[internalName];
  6358. },
  6359. getLocalName: function getLocalName(internalName) {
  6360. if (internalName.indexOf(".") !== -1) {
  6361. var names = internalName.split(".");
  6362. var libName = _languageService.LanguageService.getCurrentLangLibs()[names[0]];
  6363. var funName = _languageService.LanguageService.getCurrentLangFuncs()[names[1]];
  6364. return libName + '.' + funName;
  6365. } else if (_languageService.LanguageService.getCurrentLangFuncs()[internalName]) {
  6366. return _languageService.LanguageService.getCurrentLangFuncs()[internalName];
  6367. } else {
  6368. return internalName;
  6369. }
  6370. }
  6371. });
  6372. /***/ }),
  6373. /***/ "./js/processor/error/processorErrorFactory.js":
  6374. /*!*****************************************************!*\
  6375. !*** ./js/processor/error/processorErrorFactory.js ***!
  6376. \*****************************************************/
  6377. /*! no static exports found */
  6378. /***/ (function(module, exports, __webpack_require__) {
  6379. "use strict";
  6380. Object.defineProperty(exports, "__esModule", {
  6381. value: true
  6382. });
  6383. exports.ProcessorErrorFactory = undefined;
  6384. var _runtimeError = __webpack_require__(/*! ./runtimeError */ "./js/processor/error/runtimeError.js");
  6385. var _semanticError = __webpack_require__(/*! ./semanticError */ "./js/processor/error/semanticError.js");
  6386. var _localizedStringsService = __webpack_require__(/*! ./../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  6387. var _operators = __webpack_require__(/*! ../../ast/operators */ "./js/ast/operators.js");
  6388. function translateType(type, dim) {
  6389. switch (dim) {
  6390. case 0:
  6391. return _localizedStringsService.LocalizedStrings.getUI(type);
  6392. default:
  6393. var transType = _localizedStringsService.LocalizedStrings.getUI(type);
  6394. if (dim === 1) return _localizedStringsService.LocalizedStrings.getUI("vector_string", [transType]);else return _localizedStringsService.LocalizedStrings.getUI("matrix_string", [transType]);
  6395. }
  6396. }
  6397. function translateOp(op) {
  6398. switch (op.ord) {
  6399. case _operators.Operators.AND.ord:
  6400. case _operators.Operators.OR.ord:
  6401. case _operators.Operators.NOT.ord:
  6402. return _localizedStringsService.LocalizedStrings.getUI(op.value);
  6403. default:
  6404. return op.value;
  6405. }
  6406. }
  6407. var ProcessorErrorFactory = exports.ProcessorErrorFactory = Object.freeze({
  6408. symbol_not_found_full: function symbol_not_found_full(id, sourceInfo) {
  6409. if (sourceInfo) {
  6410. var context = [id, sourceInfo.line, sourceInfo.column];
  6411. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("symbol_not_found_full", context));
  6412. } else {
  6413. return ProcessorErrorFactory.symbol_not_found(id);
  6414. }
  6415. },
  6416. symbol_not_found: function symbol_not_found(id) {
  6417. var context = [id];
  6418. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("symbol_not_found", context));
  6419. },
  6420. function_missing_full: function function_missing_full(id, sourceInfo) {
  6421. if (sourceInfo) {
  6422. var context = [id, sourceInfo.line, sourceInfo.column];
  6423. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("function_missing_full", context));
  6424. } else {
  6425. return ProcessorErrorFactory.function_missing(id);
  6426. }
  6427. },
  6428. function_missing: function function_missing(id) {
  6429. var context = [id];
  6430. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("function_missing", context));
  6431. },
  6432. main_missing: function main_missing() {
  6433. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("main_missing"));
  6434. }, // TODO: better urgent error message
  6435. array_dimension_not_int_full: function array_dimension_not_int_full(sourceInfo) {
  6436. if (sourceInfo) {
  6437. var context = [sourceInfo.line];
  6438. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("array_dimension_not_int_full", context));
  6439. } else {
  6440. return ProcessorErrorFactory.array_dimension_not_int();
  6441. }
  6442. },
  6443. array_dimension_not_int: function array_dimension_not_int() {
  6444. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("array_dimension_not_int"));
  6445. },
  6446. unknown_command_full: function unknown_command_full(sourceInfo) {
  6447. if (sourceInfo) {
  6448. var context = [sourceInfo.line];
  6449. return new _runtimeError.RuntimeError(_localizedStringsService.LocalizedStrings.getError("unknown_command_full", context));
  6450. } else {
  6451. return ProcessorErrorFactory.unknown_command();
  6452. }
  6453. },
  6454. unknown_command: function unknown_command() {
  6455. return new _runtimeError.RuntimeError(_localizedStringsService.LocalizedStrings.getError("unknown_command"));
  6456. },
  6457. incompatible_types_full: function incompatible_types_full(type, dim, sourceInfo) {
  6458. if (sourceInfo) {
  6459. var context = [translateType(type, dim), sourceInfo.line, sourceInfo.column];
  6460. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("incompatible_types_full", context));
  6461. } else {
  6462. return ProcessorErrorFactory.incompatible_types(type, dim);
  6463. }
  6464. },
  6465. incompatible_types: function incompatible_types(type, dim) {
  6466. var context = [translateType(type, dim)];
  6467. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("incompatible_types", context));
  6468. },
  6469. incompatible_types_array_full: function incompatible_types_array_full(exp, type, dim, sourceInfo) {
  6470. if (sourceInfo) {
  6471. var context = [exp, translateType(type, dim), sourceInfo.line, sourceInfo.column];
  6472. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("incompatible_types_array_full", context));
  6473. } else {
  6474. return ProcessorErrorFactory.incompatible_types_array(exp, type, dim);
  6475. }
  6476. },
  6477. incompatible_types_array: function incompatible_types_array(exp, type, dim) {
  6478. var context = [exp, translateType(type, dim)];
  6479. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("incompatible_types_array", context));
  6480. },
  6481. loop_condition_type_full: function loop_condition_type_full(sourceInfo) {
  6482. if (sourceInfo) {
  6483. var context = [sourceInfo.line, sourceInfo.column];
  6484. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("loop_condition_type_full", context));
  6485. } else {
  6486. return ProcessorErrorFactory.loop_condition_type();
  6487. }
  6488. },
  6489. loop_condition_type: function loop_condition_type() {
  6490. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("loop_condition_type"));
  6491. },
  6492. endless_loop_full: function endless_loop_full(sourceInfo) {
  6493. if (sourceInfo) {
  6494. var context = [sourceInfo.line];
  6495. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("endless_loop_full", context));
  6496. } else {
  6497. return ProcessorErrorFactory.endless_loop();
  6498. }
  6499. },
  6500. endless_loop: function endless_loop() {
  6501. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("endless_loop"));
  6502. },
  6503. for_condition_type_full: function for_condition_type_full(sourceInfo) {
  6504. if (sourceInfo) {
  6505. var context = [sourceInfo.line, sourceInfo.column];
  6506. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("for_condition_type_full", context));
  6507. } else {
  6508. return ProcessorErrorFactory.for_condition_type();
  6509. }
  6510. },
  6511. for_condition_type: function for_condition_type() {
  6512. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("for_condition_type"));
  6513. },
  6514. if_condition_type_full: function if_condition_type_full(sourceInfo) {
  6515. if (sourceInfo) {
  6516. var context = [sourceInfo.line, sourceInfo.column];
  6517. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("if_condition_type_full", context));
  6518. } else {
  6519. return ProcessorErrorFactory.if_condition_type();
  6520. }
  6521. },
  6522. if_condition_type: function if_condition_type() {
  6523. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("if_condition_type"));
  6524. },
  6525. invalid_global_var: function invalid_global_var() {
  6526. return new _runtimeError.RuntimeError(_localizedStringsService.LocalizedStrings.getError("invalid_global_var"));
  6527. },
  6528. not_implemented: function not_implemented(id) {
  6529. var context = [id];
  6530. return new _runtimeError.RuntimeError(_localizedStringsService.LocalizedStrings.getError("not_implemented", context));
  6531. },
  6532. invalid_case_type_full: function invalid_case_type_full(exp, type, dim, sourceInfo) {
  6533. if (sourceInfo) {
  6534. var context = [exp, translateType(type, dim), sourceInfo.line, sourceInfo.column];
  6535. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("invalid_case_type_full", context));
  6536. } else {
  6537. return ProcessorErrorFactory.invalid_case_type(exp, type, dim);
  6538. }
  6539. },
  6540. invalid_case_type: function invalid_case_type(exp, type, dim) {
  6541. var context = [exp, translateType(type, dim)];
  6542. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("invalid_case_type", context));
  6543. },
  6544. void_in_expression_full: function void_in_expression_full(id, sourceInfo) {
  6545. if (sourceInfo) {
  6546. var context = [sourceInfo.line, sourceInfo.column, id];
  6547. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("void_in_expression_full", context));
  6548. } else {
  6549. return ProcessorErrorFactory.void_in_expression(id);
  6550. }
  6551. },
  6552. void_in_expression: function void_in_expression(id) {
  6553. var context = [id];
  6554. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("void_in_expression", context));
  6555. },
  6556. invalid_array_access_full: function invalid_array_access_full(id, sourceInfo) {
  6557. if (sourceInfo) {
  6558. var context = [id, sourceInfo.line, sourceInfo.column];
  6559. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("invalid_array_access_full", context));
  6560. } else {
  6561. return ProcessorErrorFactory.invalid_array_access(id);
  6562. }
  6563. },
  6564. invalid_array_access: function invalid_array_access(id) {
  6565. var context = [id];
  6566. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("invalid_array_access", context));
  6567. },
  6568. invalid_matrix_access_full: function invalid_matrix_access_full(id, sourceInfo) {
  6569. if (sourceInfo) {
  6570. var context = [id, sourceInfo.line, sourceInfo.column];
  6571. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("invalid_matrix_access_full", context));
  6572. } else {
  6573. return ProcessorErrorFactory.invalid_matrix_access(id);
  6574. }
  6575. },
  6576. invalid_matrix_access: function invalid_matrix_access(id) {
  6577. var context = [id];
  6578. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("invalid_matrix_access", context));
  6579. },
  6580. matrix_column_outbounds_full: function matrix_column_outbounds_full(id, value, columns, sourceInfo) {
  6581. if (sourceInfo) {
  6582. var context = [sourceInfo.line, value, id, columns];
  6583. return new _runtimeError.RuntimeError(_localizedStringsService.LocalizedStrings.getError("matrix_column_outbounds_full", context));
  6584. } else {
  6585. return ProcessorErrorFactory.matrix_column_outbounds(id, value, columns);
  6586. }
  6587. },
  6588. matrix_column_outbounds: function matrix_column_outbounds(id, value, columns) {
  6589. var context = [value, id, columns];
  6590. return new _runtimeError.RuntimeError(_localizedStringsService.LocalizedStrings.getError("matrix_column_outbounds", context));
  6591. },
  6592. matrix_line_outbounds_full: function matrix_line_outbounds_full(id, value, lines, sourceInfo) {
  6593. if (sourceInfo) {
  6594. var context = [sourceInfo.line, value, id, lines];
  6595. return new _runtimeError.RuntimeError(_localizedStringsService.LocalizedStrings.getError("matrix_line_outbounds_full", context));
  6596. } else {
  6597. return ProcessorErrorFactory.matrix_line_outbounds(id, value, lines);
  6598. }
  6599. },
  6600. matrix_line_outbounds: function matrix_line_outbounds(id, value, lines) {
  6601. var context = [value, id, lines];
  6602. return new _runtimeError.RuntimeError(_localizedStringsService.LocalizedStrings.getError("matrix_line_outbounds", context));
  6603. },
  6604. vector_line_outbounds_full: function vector_line_outbounds_full(id, value, lines, sourceInfo) {
  6605. if (sourceInfo) {
  6606. var context = [sourceInfo.line, value, id, lines];
  6607. return new _runtimeError.RuntimeError(_localizedStringsService.LocalizedStrings.getError("vector_line_outbounds_full", context));
  6608. } else {
  6609. return ProcessorErrorFactory.vector_line_outbounds(id, value, lines);
  6610. }
  6611. },
  6612. vector_line_outbounds: function vector_line_outbounds(id, value, lines) {
  6613. var context = [value, id, lines];
  6614. return new _runtimeError.RuntimeError(_localizedStringsService.LocalizedStrings.getError("vector_line_outbounds", context));
  6615. },
  6616. vector_not_matrix_full: function vector_not_matrix_full(id, sourceInfo) {
  6617. if (sourceInfo) {
  6618. var context = [sourceInfo.line, id];
  6619. return new _runtimeError.RuntimeError(_localizedStringsService.LocalizedStrings.getError("vector_not_matrix_full", context));
  6620. } else {
  6621. return ProcessorErrorFactory.vector_not_matrix(id);
  6622. }
  6623. },
  6624. vector_not_matrix: function vector_not_matrix(id) {
  6625. var context = [id];
  6626. return new _runtimeError.RuntimeError(_localizedStringsService.LocalizedStrings.getError("vector_not_matrix", context));
  6627. },
  6628. function_no_return: function function_no_return(id) {
  6629. var context = [id];
  6630. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("function_no_return", context));
  6631. },
  6632. invalid_void_return_full: function invalid_void_return_full(id, type, dim, sourceInfo) {
  6633. if (sourceInfo) {
  6634. var context = [sourceInfo.line, id, translateType(type, dim)];
  6635. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("invalid_void_return_full", context));
  6636. } else {
  6637. return ProcessorErrorFactory.invalid_void_return(id, type, dim);
  6638. }
  6639. },
  6640. invalid_void_return: function invalid_void_return(id, type, dim) {
  6641. var context = [id, translateType(type, dim)];
  6642. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("invalid_void_return_full", context));
  6643. },
  6644. invalid_return_type_full: function invalid_return_type_full(id, type, dim, sourceInfo) {
  6645. if (sourceInfo) {
  6646. var context = [sourceInfo.line, id, translateType(type, dim)];
  6647. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("invalid_return_type_full", context));
  6648. } else {
  6649. return ProcessorErrorFactory.invalid_return_type(id, type, dim);
  6650. }
  6651. },
  6652. invalid_return_type: function invalid_return_type(id, type, dim) {
  6653. var context = [id, translateType(type, dim)];
  6654. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("invalid_return_type", context));
  6655. },
  6656. invalid_parameters_size_full: function invalid_parameters_size_full(id, expected, actual, sourceInfo) {
  6657. if (sourceInfo) {
  6658. var context = [sourceInfo.line, id, expected, actual];
  6659. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("invalid_parameters_size_full", context));
  6660. } else {
  6661. return ProcessorErrorFactory.invalid_parameters_size(id, expected, actual);
  6662. }
  6663. },
  6664. invalid_parameters_size: function invalid_parameters_size(id, expected, actual) {
  6665. var context = [id, expected, actual];
  6666. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("invalid_parameters_size", context));
  6667. },
  6668. invalid_parameter_type_full: function invalid_parameter_type_full(id, exp, sourceInfo) {
  6669. if (sourceInfo) {
  6670. var context = [exp, id, sourceInfo.line];
  6671. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("invalid_parameter_type_full", context));
  6672. } else {
  6673. return ProcessorErrorFactory.invalid_parameter_type(id, exp);
  6674. }
  6675. },
  6676. invalid_parameter_type: function invalid_parameter_type(id, exp) {
  6677. var context = [exp, id];
  6678. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("invalid_parameter_type_full", context));
  6679. },
  6680. invalid_ref_full: function invalid_ref_full(id, exp, sourceInfo) {
  6681. if (sourceInfo) {
  6682. var context = [exp, id, sourceInfo.line];
  6683. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("invalid_ref_full", context));
  6684. } else {
  6685. return ProcessorErrorFactory.invalid_ref(id, exp);
  6686. }
  6687. },
  6688. invalid_ref: function invalid_ref(id, exp) {
  6689. var context = [exp, id];
  6690. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("invalid_ref", context));
  6691. },
  6692. unexpected_break_command_full: function unexpected_break_command_full(sourceInfo) {
  6693. if (sourceInfo) {
  6694. var context = [sourceInfo.line];
  6695. return new _runtimeError.RuntimeError(_localizedStringsService.LocalizedStrings.getError("unexpected_break_command_full", context));
  6696. } else {
  6697. return ProcessorErrorFactory.unexpected_break_command();
  6698. }
  6699. },
  6700. unexpected_break_command: function unexpected_break_command() {
  6701. return new _runtimeError.RuntimeError(_localizedStringsService.LocalizedStrings.getError("unexpected_break_command"));
  6702. },
  6703. invalid_array_literal_type_full: function invalid_array_literal_type_full(exp, sourceInfo) {
  6704. if (sourceInfo) {
  6705. var context = [sourceInfo.line, exp];
  6706. return new _runtimeError.RuntimeError(_localizedStringsService.LocalizedStrings.getError("invalid_array_literal_type_full", context));
  6707. } else {
  6708. return ProcessorErrorFactory.invalid_array_literal_type(exp);
  6709. }
  6710. },
  6711. invalid_array_literal_type: function invalid_array_literal_type(exp) {
  6712. var context = [exp];
  6713. return new _runtimeError.RuntimeError(_localizedStringsService.LocalizedStrings.getError("invalid_array_literal_type", context));
  6714. },
  6715. invalid_array_literal_line_full: function invalid_array_literal_line_full(expected, actual, sourceInfo) {
  6716. if (sourceInfo) {
  6717. var context = [sourceInfo.line, expected, actual];
  6718. return new _runtimeError.RuntimeError(_localizedStringsService.LocalizedStrings.getError("invalid_array_literal_line_full", context));
  6719. } else {
  6720. return ProcessorErrorFactory.invalid_array_literal_type(expected, actual);
  6721. }
  6722. },
  6723. invalid_array_literal_line: function invalid_array_literal_line(expected, actual) {
  6724. var context = [expected, actual];
  6725. return new _runtimeError.RuntimeError(_localizedStringsService.LocalizedStrings.getError("invalid_array_literal_line", context));
  6726. },
  6727. invalid_array_literal_column_full: function invalid_array_literal_column_full(expected, actual, sourceInfo) {
  6728. if (sourceInfo) {
  6729. var context = [sourceInfo.line, expected, actual];
  6730. return new _runtimeError.RuntimeError(_localizedStringsService.LocalizedStrings.getError("invalid_array_literal_column_full", context));
  6731. } else {
  6732. return ProcessorErrorFactory.invalid_array_literal_column(expected, actual);
  6733. }
  6734. },
  6735. invalid_array_literal_column: function invalid_array_literal_column(expected, actual) {
  6736. var context = [expected, actual];
  6737. return new _runtimeError.RuntimeError(_localizedStringsService.LocalizedStrings.getError("invalid_array_literal_column", context));
  6738. },
  6739. invalid_unary_op_full: function invalid_unary_op_full(opName, type, dim, sourceInfo) {
  6740. if (sourceInfo) {
  6741. var context = [sourceInfo.line, translateOp(opName), translateType(type, dim)];
  6742. return new _runtimeError.RuntimeError(_localizedStringsService.LocalizedStrings.getError("invalid_unary_op_full", context));
  6743. } else {
  6744. return ProcessorErrorFactory.invalid_unary_op(opName, type, dim);
  6745. }
  6746. },
  6747. invalid_unary_op: function invalid_unary_op(opName, type, dim) {
  6748. var context = [translateOp(opName), translateType(type, dim)];
  6749. return new _runtimeError.RuntimeError(_localizedStringsService.LocalizedStrings.getError("invalid_unary_op", context));
  6750. },
  6751. invalid_infix_op_full: function invalid_infix_op_full(opName, typeLeft, dimLeft, typeRight, dimRight, sourceInfo) {
  6752. if (sourceInfo) {
  6753. var context = [sourceInfo.line, translateOp(opName), translateType(typeLeft, dimLeft), translateType(typeRight, dimRight)];
  6754. return new _runtimeError.RuntimeError(_localizedStringsService.LocalizedStrings.getError("invalid_infix_op_full", context));
  6755. } else {
  6756. return ProcessorErrorFactory.invalid_infix_op(opName, typeLeft, dimLeft, typeRight, dimRight);
  6757. }
  6758. },
  6759. invalid_infix_op: function invalid_infix_op(opName, typeLeft, dimLeft, typeRight, dimRight) {
  6760. var context = [translateOp(opName), translateType(typeLeft, dimLeft), translateType(typeRight, dimRight)];
  6761. return new _runtimeError.RuntimeError(_localizedStringsService.LocalizedStrings.getError("invalid_infix_op", context));
  6762. },
  6763. array_dimension_not_positive_full: function array_dimension_not_positive_full(sourceInfo) {
  6764. if (sourceInfo) {
  6765. var context = [sourceInfo.line];
  6766. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("array_dimension_not_positive_full", context));
  6767. } else {
  6768. return ProcessorErrorFactory.array_dimension_not_positive();
  6769. }
  6770. },
  6771. array_dimension_not_positive: function array_dimension_not_positive() {
  6772. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("array_dimension_not_positive"));
  6773. }
  6774. });
  6775. /***/ }),
  6776. /***/ "./js/processor/error/runtimeError.js":
  6777. /*!********************************************!*\
  6778. !*** ./js/processor/error/runtimeError.js ***!
  6779. \********************************************/
  6780. /*! no static exports found */
  6781. /***/ (function(module, exports, __webpack_require__) {
  6782. "use strict";
  6783. Object.defineProperty(exports, "__esModule", {
  6784. value: true
  6785. });
  6786. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  6787. 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; }
  6788. 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; }
  6789. var RuntimeError = exports.RuntimeError = function (_Error) {
  6790. _inherits(RuntimeError, _Error);
  6791. function RuntimeError() {
  6792. var _ref;
  6793. _classCallCheck(this, RuntimeError);
  6794. for (var _len = arguments.length, msg = Array(_len), _key = 0; _key < _len; _key++) {
  6795. msg[_key] = arguments[_key];
  6796. }
  6797. var _this = _possibleConstructorReturn(this, (_ref = RuntimeError.__proto__ || Object.getPrototypeOf(RuntimeError)).call.apply(_ref, [this].concat(msg)));
  6798. if (Error.captureStackTrace) Error.captureStackTrace(_this, RuntimeError);
  6799. return _this;
  6800. }
  6801. return RuntimeError;
  6802. }(Error);
  6803. /***/ }),
  6804. /***/ "./js/processor/error/semanticError.js":
  6805. /*!*********************************************!*\
  6806. !*** ./js/processor/error/semanticError.js ***!
  6807. \*********************************************/
  6808. /*! no static exports found */
  6809. /***/ (function(module, exports, __webpack_require__) {
  6810. "use strict";
  6811. Object.defineProperty(exports, "__esModule", {
  6812. value: true
  6813. });
  6814. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  6815. 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; }
  6816. 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; }
  6817. var SemanticError = exports.SemanticError = function (_Error) {
  6818. _inherits(SemanticError, _Error);
  6819. function SemanticError() {
  6820. var _ref;
  6821. _classCallCheck(this, SemanticError);
  6822. for (var _len = arguments.length, msg = Array(_len), _key = 0; _key < _len; _key++) {
  6823. msg[_key] = arguments[_key];
  6824. }
  6825. var _this = _possibleConstructorReturn(this, (_ref = SemanticError.__proto__ || Object.getPrototypeOf(SemanticError)).call.apply(_ref, [this].concat(msg)));
  6826. if (Error.captureStackTrace) Error.captureStackTrace(_this, SemanticError);
  6827. return _this;
  6828. }
  6829. return SemanticError;
  6830. }(Error);
  6831. /***/ }),
  6832. /***/ "./js/processor/ivprogProcessor.js":
  6833. /*!*****************************************!*\
  6834. !*** ./js/processor/ivprogProcessor.js ***!
  6835. \*****************************************/
  6836. /*! no static exports found */
  6837. /***/ (function(module, exports, __webpack_require__) {
  6838. "use strict";
  6839. Object.defineProperty(exports, "__esModule", {
  6840. value: true
  6841. });
  6842. exports.IVProgProcessor = undefined;
  6843. 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; }; }();
  6844. var _store = __webpack_require__(/*! ./store/store */ "./js/processor/store/store.js");
  6845. var _storeObject = __webpack_require__(/*! ./store/storeObject */ "./js/processor/store/storeObject.js");
  6846. var _storeObjectArray = __webpack_require__(/*! ./store/storeObjectArray */ "./js/processor/store/storeObjectArray.js");
  6847. var _storeObjectRef = __webpack_require__(/*! ./store/storeObjectRef */ "./js/processor/store/storeObjectRef.js");
  6848. var _modes = __webpack_require__(/*! ./modes */ "./js/processor/modes.js");
  6849. var _context = __webpack_require__(/*! ./context */ "./js/processor/context.js");
  6850. var _types = __webpack_require__(/*! ./../typeSystem/types */ "./js/typeSystem/types.js");
  6851. var _operators = __webpack_require__(/*! ./../ast/operators */ "./js/ast/operators.js");
  6852. var _definedFunctions = __webpack_require__(/*! ./definedFunctions */ "./js/processor/definedFunctions.js");
  6853. var _compatibilityTable = __webpack_require__(/*! ./compatibilityTable */ "./js/processor/compatibilityTable.js");
  6854. var _commands = __webpack_require__(/*! ./../ast/commands/ */ "./js/ast/commands/index.js");
  6855. var Commands = _interopRequireWildcard(_commands);
  6856. var _expressions = __webpack_require__(/*! ./../ast/expressions/ */ "./js/ast/expressions/index.js");
  6857. var Expressions = _interopRequireWildcard(_expressions);
  6858. var _storeObjectArrayAddress = __webpack_require__(/*! ./store/storeObjectArrayAddress */ "./js/processor/store/storeObjectArrayAddress.js");
  6859. var _storeObjectArrayAddressRef = __webpack_require__(/*! ./store/storeObjectArrayAddressRef */ "./js/processor/store/storeObjectArrayAddressRef.js");
  6860. var _compoundType = __webpack_require__(/*! ./../typeSystem/compoundType */ "./js/typeSystem/compoundType.js");
  6861. var _parsers = __webpack_require__(/*! ../typeSystem/parsers */ "./js/typeSystem/parsers.js");
  6862. var _config = __webpack_require__(/*! ../util/config */ "./js/util/config.js");
  6863. var _decimal = __webpack_require__(/*! decimal.js */ "./node_modules/decimal.js/decimal.js");
  6864. var _decimal2 = _interopRequireDefault(_decimal);
  6865. var _processorErrorFactory = __webpack_require__(/*! ./error/processorErrorFactory */ "./js/processor/error/processorErrorFactory.js");
  6866. var _runtimeError = __webpack_require__(/*! ./error/runtimeError */ "./js/processor/error/runtimeError.js");
  6867. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  6868. 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; } }
  6869. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  6870. var IVProgProcessor = exports.IVProgProcessor = function () {
  6871. _createClass(IVProgProcessor, null, [{
  6872. key: 'LOOP_TIMEOUT',
  6873. get: function get() {
  6874. return _config.Config.loopTimeout;
  6875. },
  6876. set: function set(ms) {
  6877. _config.Config.setConfig({ loopTimeout: ms });
  6878. }
  6879. }, {
  6880. key: 'MAIN_INTERNAL_ID',
  6881. get: function get() {
  6882. return "$main";
  6883. }
  6884. }]);
  6885. function IVProgProcessor(ast) {
  6886. _classCallCheck(this, IVProgProcessor);
  6887. this.ast = ast;
  6888. this.globalStore = new _store.Store("$global");
  6889. this.stores = [this.globalStore];
  6890. this.context = [_context.Context.BASE];
  6891. this.input = null;
  6892. this.forceKill = false;
  6893. this.loopTimers = [];
  6894. this.output = null;
  6895. }
  6896. _createClass(IVProgProcessor, [{
  6897. key: 'registerInput',
  6898. value: function registerInput(input) {
  6899. if (this.input !== null) this.input = null;
  6900. this.input = input;
  6901. }
  6902. }, {
  6903. key: 'registerOutput',
  6904. value: function registerOutput(output) {
  6905. if (this.output !== null) this.output = null;
  6906. this.output = output;
  6907. }
  6908. }, {
  6909. key: 'checkContext',
  6910. value: function checkContext(context) {
  6911. return this.context[this.context.length - 1] === context;
  6912. }
  6913. }, {
  6914. key: 'ignoreSwitchCases',
  6915. value: function ignoreSwitchCases(store) {
  6916. if (store.mode === _modes.Modes.RETURN) {
  6917. return true;
  6918. } else if (store.mode === _modes.Modes.BREAK) {
  6919. return true;
  6920. } else {
  6921. return false;
  6922. }
  6923. }
  6924. }, {
  6925. key: 'prepareState',
  6926. value: function prepareState() {
  6927. if (this.stores !== null) {
  6928. for (var i = 0; i < this.stores.length; i++) {
  6929. delete this.stores[i];
  6930. }
  6931. this.stores = null;
  6932. }
  6933. if (this.globalStore !== null) this.globalStore = null;
  6934. this.globalStore = new _store.Store("$global");
  6935. this.stores = [this.globalStore];
  6936. this.context = [_context.Context.BASE];
  6937. }
  6938. }, {
  6939. key: 'interpretAST',
  6940. value: function interpretAST() {
  6941. var _this = this;
  6942. this.prepareState();
  6943. return this.initGlobal().then(function (_) {
  6944. var mainFunc = _this.findMainFunction();
  6945. if (mainFunc === null) {
  6946. throw _processorErrorFactory.ProcessorErrorFactory.main_missing();
  6947. }
  6948. return _this.runFunction(mainFunc, [], _this.globalStore);
  6949. });
  6950. }
  6951. }, {
  6952. key: 'initGlobal',
  6953. value: function initGlobal() {
  6954. if (!this.checkContext(_context.Context.BASE)) {
  6955. throw _processorErrorFactory.ProcessorErrorFactory.invalid_global_var();
  6956. }
  6957. return this.executeCommands(this.globalStore, this.ast.global);
  6958. }
  6959. }, {
  6960. key: 'findMainFunction',
  6961. value: function findMainFunction() {
  6962. return this.ast.functions.find(function (v) {
  6963. return v.isMain;
  6964. });
  6965. }
  6966. }, {
  6967. key: 'findFunction',
  6968. value: function findFunction(name) {
  6969. if (name.match(/^\$.+$/)) {
  6970. var fun = _definedFunctions.LanguageDefinedFunction.getFunction(name);
  6971. if (!!!fun) {
  6972. throw _processorErrorFactory.ProcessorErrorFactory.not_implemented(name);
  6973. }
  6974. return fun;
  6975. } else {
  6976. var val = this.ast.functions.find(function (v) {
  6977. return v.name === name;
  6978. });
  6979. if (!!!val) {
  6980. // TODO: better error message;
  6981. throw _processorErrorFactory.ProcessorErrorFactory.function_missing(name);
  6982. }
  6983. return val;
  6984. }
  6985. }
  6986. }, {
  6987. key: 'runFunction',
  6988. value: function runFunction(func, actualParameters, store) {
  6989. var _this2 = this;
  6990. var funcName = func.isMain ? IVProgProcessor.MAIN_INTERNAL_ID : func.name;
  6991. var funcStore = new _store.Store(funcName);
  6992. funcStore.extendStore(this.globalStore);
  6993. var returnStoreObject = null;
  6994. if (func.returnType instanceof _compoundType.CompoundType) {
  6995. if (func.returnType.dimensions > 1) {
  6996. returnStoreObject = new _storeObjectArray.StoreObjectArray(func.returnType, -1, -1, [[]]);
  6997. } else {
  6998. returnStoreObject = new _storeObjectArray.StoreObjectArray(func.returnType, -1, null, []);
  6999. }
  7000. } else {
  7001. returnStoreObject = new _storeObject.StoreObject(func.returnType, null);
  7002. }
  7003. funcStore.insertStore('$', returnStoreObject);
  7004. var newFuncStore$ = this.associateParameters(func.formalParameters, actualParameters, store, funcStore);
  7005. return newFuncStore$.then(function (sto) {
  7006. _this2.context.push(_context.Context.FUNCTION);
  7007. _this2.stores.push(sto);
  7008. return _this2.executeCommands(sto, func.variablesDeclarations).then(function (stoWithVars) {
  7009. return _this2.executeCommands(stoWithVars, func.commands);
  7010. }).then(function (finalSto) {
  7011. _this2.stores.pop();
  7012. _this2.context.pop();
  7013. return finalSto;
  7014. });
  7015. });
  7016. }
  7017. }, {
  7018. key: 'associateParameters',
  7019. value: function associateParameters(formalList, actualList, callerStore, calleeStore) {
  7020. var _this3 = this;
  7021. var funcName = calleeStore.name === IVProgProcessor.MAIN_INTERNAL_ID ? _definedFunctions.LanguageDefinedFunction.getMainFunctionName() : calleeStore.name;
  7022. if (formalList.length != actualList.length) {
  7023. throw _processorErrorFactory.ProcessorErrorFactory.invalid_parameters_size(funcName, formalList.length, actualList.length);
  7024. }
  7025. var promises$ = actualList.map(function (actualParameter) {
  7026. return _this3.evaluateExpression(callerStore, actualParameter);
  7027. });
  7028. return Promise.all(promises$).then(function (values) {
  7029. for (var i = 0; i < values.length; i++) {
  7030. var stoObj = values[i];
  7031. var exp = actualList[i];
  7032. var shouldTypeCast = false;
  7033. var formalParameter = formalList[i];
  7034. if (!formalParameter.type.isCompatible(stoObj.type)) {
  7035. if (_config.Config.enable_type_casting && !formalParameter.byRef && _store.Store.canImplicitTypeCast(formalParameter.type, stoObj.type)) {
  7036. shouldTypeCast = true;
  7037. } else {
  7038. throw _processorErrorFactory.ProcessorErrorFactory.invalid_parameter_type(funcName, exp.toString());
  7039. }
  7040. }
  7041. if (formalParameter.byRef && !stoObj.inStore) {
  7042. throw _processorErrorFactory.ProcessorErrorFactory.invalid_ref(funcName, exp.toString());
  7043. }
  7044. if (formalParameter.byRef) {
  7045. var ref = null;
  7046. if (stoObj instanceof _storeObjectArrayAddress.StoreObjectArrayAddress) {
  7047. ref = new _storeObjectArrayAddressRef.StoreObjectArrayAddressRef(stoObj);
  7048. } else {
  7049. ref = new _storeObjectRef.StoreObjectRef(stoObj.id, callerStore);
  7050. }
  7051. calleeStore.insertStore(formalParameter.id, ref);
  7052. } else {
  7053. var realValue = _this3.parseStoreObjectValue(stoObj);
  7054. if (shouldTypeCast) {
  7055. realValue = _store.Store.doImplicitCasting(formalParameter.type, realValue);
  7056. }
  7057. calleeStore.insertStore(formalParameter.id, realValue);
  7058. }
  7059. }
  7060. return calleeStore;
  7061. });
  7062. }
  7063. }, {
  7064. key: 'executeCommands',
  7065. value: function executeCommands(store, cmds) {
  7066. // helper to partially apply a function, in this case executeCommand
  7067. var outerRef = this;
  7068. var partial = function partial(fun, cmd) {
  7069. return function (sto) {
  7070. return fun(sto, cmd);
  7071. };
  7072. };
  7073. return cmds.reduce(function (lastCommand, next) {
  7074. var nextCommand = partial(outerRef.executeCommand.bind(outerRef), next);
  7075. return lastCommand.then(nextCommand);
  7076. }, Promise.resolve(store));
  7077. }
  7078. }, {
  7079. key: 'executeCommand',
  7080. value: function executeCommand(store, cmd) {
  7081. if (this.forceKill) {
  7082. return Promise.reject("FORCED_KILL!");
  7083. } else if (store.mode === _modes.Modes.PAUSE) {
  7084. return Promise.resolve(this.executeCommand(store, cmd));
  7085. } else if (store.mode === _modes.Modes.RETURN) {
  7086. return Promise.resolve(store);
  7087. } else if (this.checkContext(_context.Context.BREAKABLE) && store.mode === _modes.Modes.BREAK) {
  7088. return Promise.resolve(store);
  7089. }
  7090. if (cmd instanceof Commands.Declaration) {
  7091. return this.executeDeclaration(store, cmd);
  7092. } else if (cmd instanceof Commands.ArrayIndexAssign) {
  7093. return this.executeArrayIndexAssign(store, cmd);
  7094. } else if (cmd instanceof Commands.Assign) {
  7095. return this.executeAssign(store, cmd);
  7096. } else if (cmd instanceof Commands.Break) {
  7097. return this.executeBreak(store, cmd);
  7098. } else if (cmd instanceof Commands.Return) {
  7099. return this.executeReturn(store, cmd);
  7100. } else if (cmd instanceof Commands.IfThenElse) {
  7101. return this.executeIfThenElse(store, cmd);
  7102. } else if (cmd instanceof Commands.DoWhile) {
  7103. return this.executeDoWhile(store, cmd);
  7104. } else if (cmd instanceof Commands.While) {
  7105. return this.executeWhile(store, cmd);
  7106. } else if (cmd instanceof Commands.For) {
  7107. return this.executeFor(store, cmd);
  7108. } else if (cmd instanceof Commands.Switch) {
  7109. return this.executeSwitch(store, cmd);
  7110. } else if (cmd instanceof Expressions.FunctionCall) {
  7111. return this.executeFunctionCall(store, cmd);
  7112. } else if (cmd instanceof Commands.SysCall) {
  7113. return this.executeSysCall(store, cmd);
  7114. } else {
  7115. throw _processorErrorFactory.ProcessorErrorFactory.unknown_command(cmd.sourceInfo);
  7116. }
  7117. }
  7118. }, {
  7119. key: 'executeSysCall',
  7120. value: function executeSysCall(store, cmd) {
  7121. var func = cmd.langFunc.bind(this);
  7122. return func(store, cmd);
  7123. }
  7124. }, {
  7125. key: 'executeFunctionCall',
  7126. value: function executeFunctionCall(store, cmd) {
  7127. var func = null;
  7128. if (cmd.isMainCall) {
  7129. func = this.findMainFunction();
  7130. } else {
  7131. func = this.findFunction(cmd.id);
  7132. }
  7133. return this.runFunction(func, cmd.actualParameters, store).then(function (sto) {
  7134. if (!_types.Types.VOID.isCompatible(func.returnType) && sto.mode !== _modes.Modes.RETURN) {
  7135. var funcName = func.name === IVProgProcessor.MAIN_INTERNAL_ID ? _definedFunctions.LanguageDefinedFunction.getMainFunctionName() : func.name;
  7136. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.function_no_return(funcName));
  7137. } else {
  7138. return store;
  7139. }
  7140. });
  7141. }
  7142. }, {
  7143. key: 'executeSwitch',
  7144. value: function executeSwitch(store, cmd) {
  7145. var _this4 = this;
  7146. this.context.push(_context.Context.BREAKABLE);
  7147. var auxCaseFun = function auxCaseFun(promise, switchExp, aCase) {
  7148. return promise.then(function (result) {
  7149. var sto = result.sto;
  7150. if (_this4.ignoreSwitchCases(sto)) {
  7151. return Promise.resolve(result);
  7152. } else if (result.wasTrue || aCase.isDefault) {
  7153. var $newSto = _this4.executeCommands(result.sto, aCase.commands);
  7154. return $newSto.then(function (nSto) {
  7155. return Promise.resolve({ wasTrue: true, sto: nSto });
  7156. });
  7157. } else {
  7158. var $value = _this4.evaluateExpression(sto, new Expressions.InfixApp(_operators.Operators.EQ, switchExp, aCase.expression));
  7159. return $value.then(function (vl) {
  7160. if (vl.value) {
  7161. var _$newSto = _this4.executeCommands(result.sto, aCase.commands);
  7162. return _$newSto.then(function (nSto) {
  7163. return Promise.resolve({ wasTrue: true, sto: nSto });
  7164. });
  7165. } else {
  7166. return Promise.resolve({ wasTrue: false, sto: sto });
  7167. }
  7168. });
  7169. }
  7170. });
  7171. };
  7172. try {
  7173. var breakLoop = false;
  7174. var $result = Promise.resolve({ wasTrue: false, sto: store });
  7175. for (var index = 0; index < cmd.cases.length && !breakLoop; index++) {
  7176. var aCase = cmd.cases[index];
  7177. $result = auxCaseFun($result, cmd.expression, aCase);
  7178. $result.then(function (r) {
  7179. return breakLoop = _this4.ignoreSwitchCases(r.sto);
  7180. });
  7181. }
  7182. return $result.then(function (r) {
  7183. _this4.context.pop();
  7184. if (r.sto.mode === _modes.Modes.BREAK) {
  7185. r.sto.mode = _modes.Modes.RUN;
  7186. }
  7187. return r.sto;
  7188. });
  7189. } catch (error) {
  7190. return Promise.reject(error);
  7191. }
  7192. }
  7193. }, {
  7194. key: 'executeFor',
  7195. value: function executeFor(store, cmd) {
  7196. try {
  7197. //BEGIN for -> while rewrite
  7198. var initCmd = cmd.assignment;
  7199. var condition = cmd.condition;
  7200. var increment = cmd.increment;
  7201. var whileBlock = new Commands.CommandBlock([], cmd.commands.concat(increment));
  7202. var forAsWhile = new Commands.While(condition, whileBlock);
  7203. forAsWhile.sourceInfo = cmd.sourceInfo;
  7204. //END for -> while rewrite
  7205. var newCmdList = [initCmd, forAsWhile];
  7206. return this.executeCommands(store, newCmdList);
  7207. } catch (error) {
  7208. return Promise.reject(error);
  7209. }
  7210. }
  7211. }, {
  7212. key: 'executeDoWhile',
  7213. value: function executeDoWhile(store, cmd) {
  7214. var outerRef = this;
  7215. try {
  7216. outerRef.loopTimers.push(Date.now());
  7217. outerRef.context.push(_context.Context.BREAKABLE);
  7218. var $newStore = outerRef.executeCommands(store, cmd.commands);
  7219. return $newStore.then(function (sto) {
  7220. if (sto.mode === _modes.Modes.BREAK) {
  7221. outerRef.context.pop();
  7222. sto.mode = _modes.Modes.RUN;
  7223. outerRef.loopTimers.pop();
  7224. return sto;
  7225. }
  7226. var $value = outerRef.evaluateExpression(sto, cmd.expression);
  7227. return $value.then(function (vl) {
  7228. if (!vl.type.isCompatible(_types.Types.BOOLEAN)) {
  7229. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.loop_condition_type_full(cmd.sourceInfo));
  7230. }
  7231. if (vl.value) {
  7232. outerRef.context.pop();
  7233. for (var i = 0; i < outerRef.loopTimers.length; i++) {
  7234. var time = outerRef.loopTimers[i];
  7235. if (Date.now() - time >= IVProgProcessor.LOOP_TIMEOUT) {
  7236. outerRef.forceKill = true;
  7237. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.endless_loop_full(cmd.sourceInfo));
  7238. }
  7239. }
  7240. return outerRef.executeCommand(sto, cmd);
  7241. } else {
  7242. outerRef.context.pop();
  7243. outerRef.loopTimers.pop();
  7244. return sto;
  7245. }
  7246. });
  7247. });
  7248. } catch (error) {
  7249. return Promise.reject(error);
  7250. }
  7251. }
  7252. }, {
  7253. key: 'executeWhile',
  7254. value: function executeWhile(store, cmd) {
  7255. var outerRef = this;
  7256. try {
  7257. outerRef.loopTimers.push(Date.now());
  7258. outerRef.context.push(_context.Context.BREAKABLE);
  7259. var $value = outerRef.evaluateExpression(store, cmd.expression);
  7260. return $value.then(function (vl) {
  7261. if (vl.type.isCompatible(_types.Types.BOOLEAN)) {
  7262. if (vl.value) {
  7263. var $newStore = outerRef.executeCommands(store, cmd.commands);
  7264. return $newStore.then(function (sto) {
  7265. outerRef.context.pop();
  7266. if (sto.mode === _modes.Modes.BREAK) {
  7267. outerRef.loopTimers.pop();
  7268. sto.mode = _modes.Modes.RUN;
  7269. return sto;
  7270. }
  7271. for (var i = 0; i < outerRef.loopTimers.length; i++) {
  7272. var time = outerRef.loopTimers[i];
  7273. if (Date.now() - time >= IVProgProcessor.LOOP_TIMEOUT) {
  7274. outerRef.forceKill = true;
  7275. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.endless_loop_full(cmd.sourceInfo));
  7276. }
  7277. }
  7278. return outerRef.executeCommand(sto, cmd);
  7279. });
  7280. } else {
  7281. outerRef.context.pop();
  7282. outerRef.loopTimers.pop();
  7283. return store;
  7284. }
  7285. } else {
  7286. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.loop_condition_type_full(cmd.sourceInfo));
  7287. }
  7288. });
  7289. } catch (error) {
  7290. return Promise.reject(error);
  7291. }
  7292. }
  7293. }, {
  7294. key: 'executeIfThenElse',
  7295. value: function executeIfThenElse(store, cmd) {
  7296. var _this5 = this;
  7297. try {
  7298. var $value = this.evaluateExpression(store, cmd.condition);
  7299. return $value.then(function (vl) {
  7300. if (vl.type.isCompatible(_types.Types.BOOLEAN)) {
  7301. if (vl.value) {
  7302. return _this5.executeCommands(store, cmd.ifTrue.commands);
  7303. } else if (cmd.ifFalse !== null) {
  7304. if (cmd.ifFalse instanceof Commands.IfThenElse) {
  7305. return _this5.executeCommand(store, cmd.ifFalse);
  7306. } else {
  7307. return _this5.executeCommands(store, cmd.ifFalse.commands);
  7308. }
  7309. } else {
  7310. return Promise.resolve(store);
  7311. }
  7312. } else {
  7313. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.if_condition_type_full(cmd.sourceInfo));
  7314. }
  7315. });
  7316. } catch (error) {
  7317. return Promise.reject(error);
  7318. }
  7319. }
  7320. }, {
  7321. key: 'executeReturn',
  7322. value: function executeReturn(store, cmd) {
  7323. var _this6 = this;
  7324. try {
  7325. var funcType = store.applyStore('$').type;
  7326. var $value = this.evaluateExpression(store, cmd.expression);
  7327. var funcName = store.name === IVProgProcessor.MAIN_INTERNAL_ID ? _definedFunctions.LanguageDefinedFunction.getMainFunctionName() : store.name;
  7328. return $value.then(function (vl) {
  7329. if (vl === null && funcType.isCompatible(_types.Types.VOID)) {
  7330. return Promise.resolve(store);
  7331. }
  7332. if (vl === null || !funcType.isCompatible(vl.type)) {
  7333. var stringInfo = funcType.stringInfo();
  7334. var info = stringInfo[0];
  7335. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.invalid_return_type_full(funcName, info.type, info.dim, cmd.sourceInfo));
  7336. } else {
  7337. var realValue = _this6.parseStoreObjectValue(vl);
  7338. store.updateStore('$', realValue);
  7339. store.mode = _modes.Modes.RETURN;
  7340. return Promise.resolve(store);
  7341. }
  7342. });
  7343. } catch (error) {
  7344. return Promise.reject(error);
  7345. }
  7346. }
  7347. }, {
  7348. key: 'executeBreak',
  7349. value: function executeBreak(store, cmd) {
  7350. if (this.checkContext(_context.Context.BREAKABLE)) {
  7351. store.mode = _modes.Modes.BREAK;
  7352. return Promise.resolve(store);
  7353. } else {
  7354. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.unexpected_break_command_full(cmd.sourceInfo));
  7355. }
  7356. }
  7357. }, {
  7358. key: 'executeAssign',
  7359. value: function executeAssign(store, cmd) {
  7360. var _this7 = this;
  7361. try {
  7362. var inStore = store.applyStore(cmd.id);
  7363. var $value = this.evaluateExpression(store, cmd.expression);
  7364. return $value.then(function (vl) {
  7365. var realValue = _this7.parseStoreObjectValue(vl);
  7366. if (!inStore.type.isCompatible(realValue.type)) {
  7367. if (_config.Config.enable_type_casting && _store.Store.canImplicitTypeCast(inStore.type, vl.type)) {
  7368. realValue = _store.Store.doImplicitCasting(inStore.type, realValue);
  7369. } else {
  7370. var stringInfo = inStore.type.stringInfo();
  7371. var info = stringInfo[0];
  7372. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.incompatible_types_full(info.type, info.dim, cmd.sourceInfo));
  7373. }
  7374. }
  7375. store.updateStore(cmd.id, realValue);
  7376. return store;
  7377. });
  7378. } catch (error) {
  7379. return Promise.reject(error);
  7380. }
  7381. }
  7382. }, {
  7383. key: 'executeArrayIndexAssign',
  7384. value: function executeArrayIndexAssign(store, cmd) {
  7385. var _this8 = this;
  7386. var mustBeArray = store.applyStore(cmd.id);
  7387. if (!(mustBeArray.type instanceof _compoundType.CompoundType)) {
  7388. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.invalid_array_access_full(cmd.id, cmd.sourceInfo));
  7389. }
  7390. var line$ = this.evaluateExpression(store, cmd.line);
  7391. var column$ = this.evaluateExpression(store, cmd.column);
  7392. var value$ = this.evaluateExpression(store, cmd.expression);
  7393. return Promise.all([line$, column$, value$]).then(function (results) {
  7394. var lineSO = results[0];
  7395. if (!_types.Types.INTEGER.isCompatible(lineSO.type)) {
  7396. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.array_dimension_not_int_full(cmd.sourceInfo));
  7397. }
  7398. var line = lineSO.number;
  7399. var columnSO = results[1];
  7400. var column = null;
  7401. if (columnSO !== null) {
  7402. if (!_types.Types.INTEGER.isCompatible(columnSO.type)) {
  7403. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.array_dimension_not_int_full(cmd.sourceInfo));
  7404. }
  7405. column = columnSO.number;
  7406. }
  7407. var value = _this8.parseStoreObjectValue(results[2]);
  7408. if (line >= mustBeArray.lines) {
  7409. if (mustBeArray.isVector) {
  7410. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.vector_line_outbounds_full(cmd.id, line, mustBeArray.lines, cmd.sourceInfo));
  7411. } else {
  7412. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.matrix_line_outbounds_full(cmd.id, line, mustBeArray.lines, cmd.sourceInfo));
  7413. }
  7414. } else if (line < 0) {
  7415. throw _processorErrorFactory.ProcessorErrorFactory.array_dimension_not_positive_full(cmd.sourceInfo);
  7416. }
  7417. if (column !== null && mustBeArray.columns === null) {
  7418. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.vector_not_matrix_full(cmd.id, cmd.sourceInfo));
  7419. }
  7420. if (column !== null) {
  7421. if (column >= mustBeArray.columns) {
  7422. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.matrix_column_outbounds_full(cmd.id, column, mustBeArray.columns, cmd.sourceInfo));
  7423. } else if (column < 0) {
  7424. throw _processorErrorFactory.ProcessorErrorFactory.array_dimension_not_positive_full(cmd.sourceInfo);
  7425. }
  7426. }
  7427. var newArray = Object.assign(new _storeObjectArray.StoreObjectArray(null, null, null), mustBeArray);
  7428. if (column !== null) {
  7429. if (value.type instanceof _compoundType.CompoundType || !newArray.type.canAccept(value.type)) {
  7430. var type = mustBeArray.type.innerType;
  7431. var stringInfo = type.stringInfo();
  7432. var info = stringInfo[0];
  7433. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.incompatible_types_full(info.type, info.dim, cmd.sourceInfo));
  7434. }
  7435. newArray.value[line].value[column] = value;
  7436. store.updateStore(cmd.id, newArray);
  7437. } else {
  7438. if (mustBeArray.columns !== null && value.type instanceof _compoundType.CompoundType || !newArray.type.canAccept(value.type)) {
  7439. var _type = mustBeArray.type;
  7440. var _stringInfo = _type.stringInfo();
  7441. var _info = _stringInfo[0];
  7442. var exp = cmd.expression.toString();
  7443. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.incompatible_types_array_full(exp, _info.type, _info.dim - 1, cmd.sourceInfo));
  7444. }
  7445. newArray.value[line] = value;
  7446. store.updateStore(cmd.id, newArray);
  7447. }
  7448. return store;
  7449. });
  7450. }
  7451. }, {
  7452. key: 'executeDeclaration',
  7453. value: function executeDeclaration(store, cmd) {
  7454. try {
  7455. var $value = this.evaluateExpression(store, cmd.initial);
  7456. if (cmd instanceof Commands.ArrayDeclaration) {
  7457. var $lines = this.evaluateExpression(store, cmd.lines);
  7458. var $columns = cmd.columns === null ? null : this.evaluateExpression(store, cmd.columns);
  7459. return Promise.all([$lines, $columns, $value]).then(function (values) {
  7460. var lineSO = values[0];
  7461. if (!_types.Types.INTEGER.isCompatible(lineSO.type)) {
  7462. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.array_dimension_not_int_full(cmd.sourceInfo));
  7463. }
  7464. var line = lineSO.number;
  7465. if (line < 0) {
  7466. throw _processorErrorFactory.ProcessorErrorFactory.array_dimension_not_positive_full(cmd.sourceInfo);
  7467. }
  7468. var columnSO = values[1];
  7469. var column = null;
  7470. if (columnSO !== null) {
  7471. if (!_types.Types.INTEGER.isCompatible(columnSO.type)) {
  7472. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.array_dimension_not_int_full(cmd.sourceInfo));
  7473. }
  7474. column = columnSO.number;
  7475. if (column < 0) {
  7476. throw _processorErrorFactory.ProcessorErrorFactory.array_dimension_not_positive_full(cmd.sourceInfo);
  7477. }
  7478. }
  7479. var value = values[2];
  7480. var temp = new _storeObjectArray.StoreObjectArray(cmd.type, line, column, null);
  7481. store.insertStore(cmd.id, temp);
  7482. var realValue = value;
  7483. if (value !== null) {
  7484. if (value instanceof _storeObjectArrayAddress.StoreObjectArrayAddress) {
  7485. if (value.type instanceof _compoundType.CompoundType) {
  7486. realValue = Object.assign(new _storeObjectArray.StoreObjectArray(null, null, null), value.refValue);
  7487. } else {
  7488. realValue = Object.assign(new _storeObject.StoreObject(null, null), value.refValue);
  7489. }
  7490. }
  7491. } else {
  7492. realValue = new _storeObjectArray.StoreObjectArray(cmd.type, line, column, []);
  7493. if (column !== null) {
  7494. for (var i = 0; i < line; i++) {
  7495. realValue.value.push(new _storeObjectArray.StoreObjectArray(new _compoundType.CompoundType(cmd.type.innerType, 1), column, null, []));
  7496. }
  7497. }
  7498. }
  7499. realValue.readOnly = cmd.isConst;
  7500. store.updateStore(cmd.id, realValue);
  7501. return store;
  7502. });
  7503. } else {
  7504. var temp = new _storeObject.StoreObject(cmd.type, null);
  7505. store.insertStore(cmd.id, temp);
  7506. return $value.then(function (vl) {
  7507. var realValue = vl;
  7508. if (vl !== null) {
  7509. if (!vl.type.isCompatible(cmd.type)) {
  7510. if (_config.Config.enable_type_casting && _store.Store.canImplicitTypeCast(cmd.type, vl.type)) {
  7511. realValue = _store.Store.doImplicitCasting(cmd.type, realValue);
  7512. } else {
  7513. var stringInfo = typeInfo.type.stringInfo();
  7514. var info = stringInfo[0];
  7515. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.incompatible_types_full(info.type, info.dim, cmd.sourceInfo));
  7516. }
  7517. }
  7518. if (vl instanceof _storeObjectArrayAddress.StoreObjectArrayAddress) {
  7519. if (vl.type instanceof _compoundType.CompoundType) {
  7520. return Promise.reject(new Error("!!!Critical Error: Compatibility check failed, a Type accepts a CompoundType"));
  7521. } else {
  7522. realValue = Object.assign(new _storeObject.StoreObject(null, null), vl.refValue);
  7523. }
  7524. }
  7525. } else {
  7526. realValue = new _storeObject.StoreObject(cmd.type, 0);
  7527. }
  7528. realValue.readOnly = cmd.isConst;
  7529. store.updateStore(cmd.id, realValue);
  7530. return store;
  7531. });
  7532. }
  7533. } catch (e) {
  7534. return Promise.reject(e);
  7535. }
  7536. }
  7537. }, {
  7538. key: 'evaluateExpression',
  7539. value: function evaluateExpression(store, exp) {
  7540. if (exp instanceof Expressions.UnaryApp) {
  7541. return this.evaluateUnaryApp(store, exp);
  7542. } else if (exp instanceof Expressions.InfixApp) {
  7543. return this.evaluateInfixApp(store, exp);
  7544. } else if (exp instanceof Expressions.ArrayAccess) {
  7545. return this.evaluateArrayAccess(store, exp);
  7546. } else if (exp instanceof Expressions.VariableLiteral) {
  7547. return this.evaluateVariableLiteral(store, exp);
  7548. } else if (exp instanceof Expressions.IntLiteral) {
  7549. return this.evaluateLiteral(store, exp);
  7550. } else if (exp instanceof Expressions.RealLiteral) {
  7551. return this.evaluateLiteral(store, exp);
  7552. } else if (exp instanceof Expressions.BoolLiteral) {
  7553. return this.evaluateLiteral(store, exp);
  7554. } else if (exp instanceof Expressions.StringLiteral) {
  7555. return this.evaluateLiteral(store, exp);
  7556. } else if (exp instanceof Expressions.ArrayLiteral) {
  7557. return this.evaluateArrayLiteral(store, exp);
  7558. } else if (exp instanceof Expressions.FunctionCall) {
  7559. return this.evaluateFunctionCall(store, exp);
  7560. }
  7561. return Promise.resolve(null);
  7562. }
  7563. }, {
  7564. key: 'evaluateFunctionCall',
  7565. value: function evaluateFunctionCall(store, exp) {
  7566. if (exp.isMainCall) {
  7567. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.void_in_expression_full(_definedFunctions.LanguageDefinedFunction.getMainFunctionName(), exp.sourceInfo));
  7568. }
  7569. var func = this.findFunction(exp.id);
  7570. if (_types.Types.VOID.isCompatible(func.returnType)) {
  7571. // TODO: better error message
  7572. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.void_in_expression_full(exp.id, exp.sourceInfo));
  7573. }
  7574. var $newStore = this.runFunction(func, exp.actualParameters, store);
  7575. return $newStore.then(function (sto) {
  7576. if (sto.mode !== _modes.Modes.RETURN) {
  7577. return Promise.reject(new Error("The function that was called did not had a return command: " + exp.id));
  7578. }
  7579. var val = sto.applyStore('$');
  7580. if (val instanceof _storeObjectArray.StoreObjectArray) {
  7581. return Promise.resolve(Object.assign(new _storeObjectArray.StoreObjectArray(null, null, null, null, null), val));
  7582. } else {
  7583. return Promise.resolve(Object.assign(new _storeObject.StoreObject(null, null), val));
  7584. }
  7585. });
  7586. }
  7587. }, {
  7588. key: 'evaluateArrayLiteral',
  7589. value: function evaluateArrayLiteral(store, exp) {
  7590. var errorHelperFunction = function errorHelperFunction(validationResult, exp) {
  7591. var errorCode = validationResult[0];
  7592. switch (errorCode) {
  7593. case _storeObjectArray.StoreObjectArray.WRONG_COLUMN_NUMBER:
  7594. {
  7595. var columnValue = validationResult[1];
  7596. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.invalid_array_literal_column_full(arr.columns, columnValue, exp.sourceInfo));
  7597. }
  7598. case _storeObjectArray.StoreObjectArray.WRONG_LINE_NUMBER:
  7599. {
  7600. var lineValue = validationResult[1];
  7601. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.invalid_array_literal_line_full(arr.lines, lineValue, exp.sourceInfo));
  7602. }
  7603. case _storeObjectArray.StoreObjectArray.WRONG_TYPE:
  7604. {
  7605. var line = null;
  7606. var strExp = null;
  7607. if (validationResult.length > 2) {
  7608. line = validationResult[1];
  7609. var column = validationResult[2];
  7610. strExp = exp.value[line].value[column].toString();
  7611. } else {
  7612. line = validationResult[1];
  7613. strExp = exp.value[line].toString();
  7614. }
  7615. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.invalid_array_literal_type_full(strExp, exp.sourceInfo));
  7616. }
  7617. }
  7618. };
  7619. if (!exp.isVector) {
  7620. var $matrix = this.evaluateMatrix(store, exp.value);
  7621. return $matrix.then(function (list) {
  7622. var type = new _compoundType.CompoundType(list[0].type.innerType, 2);
  7623. var arr = new _storeObjectArray.StoreObjectArray(type, list.length, list[0].lines, list);
  7624. var checkResult = arr.isValid;
  7625. if (checkResult.length == 0) return Promise.resolve(arr);else {
  7626. return errorHelperFunction(checkResult, exp);
  7627. }
  7628. });
  7629. } else {
  7630. return this.evaluateVector(store, exp.value).then(function (list) {
  7631. var type = new _compoundType.CompoundType(list[0].type, 1);
  7632. var stoArray = new _storeObjectArray.StoreObjectArray(type, list.length, null, list);
  7633. var checkResult = stoArray.isValid;
  7634. if (checkResult.length == 0) return Promise.resolve(stoArray);else {
  7635. return errorHelperFunction(checkResult, exp);
  7636. }
  7637. });
  7638. }
  7639. }
  7640. }, {
  7641. key: 'evaluateVector',
  7642. value: function evaluateVector(store, exps) {
  7643. var _this9 = this;
  7644. return Promise.all(exps.map(function (exp) {
  7645. return _this9.evaluateExpression(store, exp);
  7646. }));
  7647. }
  7648. }, {
  7649. key: 'evaluateMatrix',
  7650. value: function evaluateMatrix(store, exps) {
  7651. var _this10 = this;
  7652. return Promise.all(exps.map(function (vector) {
  7653. var $vector = _this10.evaluateVector(store, vector.value);
  7654. return $vector.then(function (list) {
  7655. var type = new _compoundType.CompoundType(list[0].type, 1);
  7656. return new _storeObjectArray.StoreObjectArray(type, list.length, null, list);
  7657. });
  7658. }));
  7659. }
  7660. }, {
  7661. key: 'evaluateLiteral',
  7662. value: function evaluateLiteral(_, exp) {
  7663. return Promise.resolve(new _storeObject.StoreObject(exp.type, exp.value));
  7664. }
  7665. }, {
  7666. key: 'evaluateVariableLiteral',
  7667. value: function evaluateVariableLiteral(store, exp) {
  7668. try {
  7669. var val = store.applyStore(exp.id);
  7670. if (val instanceof _storeObjectArray.StoreObjectArray) {
  7671. return Promise.resolve(Object.assign(new _storeObjectArray.StoreObjectArray(null, null, null, null), val));
  7672. } else {
  7673. return Promise.resolve(Object.assign(new _storeObject.StoreObject(null, null), val));
  7674. }
  7675. } catch (error) {
  7676. return Promise.reject(error);
  7677. }
  7678. }
  7679. }, {
  7680. key: 'evaluateArrayAccess',
  7681. value: function evaluateArrayAccess(store, exp) {
  7682. var mustBeArray = store.applyStore(exp.id);
  7683. if (!(mustBeArray.type instanceof _compoundType.CompoundType)) {
  7684. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.invalid_array_access_full(exp.id, exp.sourceInfo));
  7685. }
  7686. var $line = this.evaluateExpression(store, exp.line);
  7687. var $column = this.evaluateExpression(store, exp.column);
  7688. return Promise.all([$line, $column]).then(function (values) {
  7689. var lineSO = values[0];
  7690. var columnSO = values[1];
  7691. if (!_types.Types.INTEGER.isCompatible(lineSO.type)) {
  7692. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.array_dimension_not_int_full(exp.sourceInfo));
  7693. }
  7694. var line = lineSO.number;
  7695. var column = null;
  7696. if (columnSO !== null) {
  7697. if (!_types.Types.INTEGER.isCompatible(columnSO.type)) {
  7698. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.array_dimension_not_int_full(exp.sourceInfo));
  7699. }
  7700. column = columnSO.number;
  7701. }
  7702. if (line >= mustBeArray.lines) {
  7703. if (mustBeArray.isVector) {
  7704. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.vector_line_outbounds_full(exp.id, line, mustBeArray.lines, exp.sourceInfo));
  7705. } else {
  7706. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.matrix_line_outbounds_full(exp.id, line, mustBeArray.lines, exp.sourceInfo));
  7707. }
  7708. } else if (line < 0) {
  7709. throw _processorErrorFactory.ProcessorErrorFactory.array_dimension_not_positive_full(exp.sourceInfo);
  7710. }
  7711. if (column !== null && mustBeArray.columns === null) {
  7712. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.vector_not_matrix_full(exp.id, exp.sourceInfo));
  7713. }
  7714. if (column !== null) {
  7715. if (column >= mustBeArray.columns) {
  7716. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.matrix_column_outbounds_full(exp.id, column, mustBeArray.columns, exp.sourceInfo));
  7717. } else if (column < 0) {
  7718. throw _processorErrorFactory.ProcessorErrorFactory.array_dimension_not_positive_full(exp.sourceInfo);
  7719. }
  7720. }
  7721. return Promise.resolve(new _storeObjectArrayAddress.StoreObjectArrayAddress(mustBeArray.id, line, column, store));
  7722. });
  7723. }
  7724. }, {
  7725. key: 'evaluateUnaryApp',
  7726. value: function evaluateUnaryApp(store, unaryApp) {
  7727. var $left = this.evaluateExpression(store, unaryApp.left);
  7728. return $left.then(function (left) {
  7729. var resultType = (0, _compatibilityTable.resultTypeAfterUnaryOp)(unaryApp.op, left.type);
  7730. if (_types.Types.UNDEFINED.isCompatible(resultType)) {
  7731. var stringInfo = left.type.stringInfo();
  7732. var info = stringInfo[0];
  7733. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.invalid_unary_op_full(unaryApp.op, info.type, info.dim, unaryApp.sourceInfo));
  7734. }
  7735. switch (unaryApp.op.ord) {
  7736. case _operators.Operators.ADD.ord:
  7737. return new _storeObject.StoreObject(resultType, left.value);
  7738. case _operators.Operators.SUB.ord:
  7739. return new _storeObject.StoreObject(resultType, left.value.negated());
  7740. case _operators.Operators.NOT.ord:
  7741. return new _storeObject.StoreObject(resultType, !left.value);
  7742. default:
  7743. return Promise.reject(new _runtimeError.RuntimeError('!!!Critical Invalid UnaryApp ' + unaryApp.op));
  7744. }
  7745. });
  7746. }
  7747. }, {
  7748. key: 'evaluateInfixApp',
  7749. value: function evaluateInfixApp(store, infixApp) {
  7750. var $left = this.evaluateExpression(store, infixApp.left);
  7751. var $right = this.evaluateExpression(store, infixApp.right);
  7752. return Promise.all([$left, $right]).then(function (values) {
  7753. var shouldImplicitCast = false;
  7754. var left = values[0];
  7755. var right = values[1];
  7756. var resultType = (0, _compatibilityTable.resultTypeAfterInfixOp)(infixApp.op, left.type, right.type);
  7757. if (_types.Types.UNDEFINED.isCompatible(resultType)) {
  7758. if (_config.Config.enable_type_casting && _store.Store.canImplicitTypeCast(left.type, right.type)) {
  7759. shouldImplicitCast = true;
  7760. } else {
  7761. var stringInfoLeft = left.type.stringInfo();
  7762. var infoLeft = stringInfoLeft[0];
  7763. var stringInfoRight = right.type.stringInfo();
  7764. var infoRight = stringInfoRight[0];
  7765. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.invalid_infix_op_full(infixApp.op, infoLeft.type, infoLeft.dim, infoRight.type, infoRight.dim, infixApp.sourceInfo));
  7766. }
  7767. }
  7768. var result = null;
  7769. switch (infixApp.op.ord) {
  7770. case _operators.Operators.ADD.ord:
  7771. {
  7772. if (_types.Types.STRING.isCompatible(left.type)) {
  7773. var rightStr = (0, _parsers.convertToString)(right.value, right.type);
  7774. return new _storeObject.StoreObject(resultType, left.value + rightStr);
  7775. } else if (_types.Types.STRING.isCompatible(right.type)) {
  7776. var leftStr = (0, _parsers.convertToString)(left.value, left.type);
  7777. return new _storeObject.StoreObject(resultType, leftStr + right.value);
  7778. } else {
  7779. return new _storeObject.StoreObject(resultType, left.value.plus(right.value));
  7780. }
  7781. }
  7782. case _operators.Operators.SUB.ord:
  7783. return new _storeObject.StoreObject(resultType, left.value.minus(right.value));
  7784. case _operators.Operators.MULT.ord:
  7785. {
  7786. result = left.value.times(right.value);
  7787. if (result.dp() > _config.Config.decimalPlaces) {
  7788. result = new _decimal2.default(result.toFixed(_config.Config.decimalPlaces));
  7789. }
  7790. return new _storeObject.StoreObject(resultType, result);
  7791. }
  7792. case _operators.Operators.DIV.ord:
  7793. {
  7794. if (_types.Types.INTEGER.isCompatible(resultType)) result = left.value.divToInt(right.value);else result = left.value.div(right.value);
  7795. if (result.dp() > _config.Config.decimalPlaces) {
  7796. result = new _decimal2.default(result.toFixed(_config.Config.decimalPlaces));
  7797. }
  7798. return new _storeObject.StoreObject(resultType, result);
  7799. }
  7800. case _operators.Operators.MOD.ord:
  7801. {
  7802. var leftValue = left.value;
  7803. var rightValue = right.value;
  7804. if (shouldImplicitCast) {
  7805. resultType = _types.Types.INTEGER;
  7806. leftValue = leftValue.trunc();
  7807. rightValue = rightValue.trunc();
  7808. }
  7809. result = leftValue.modulo(rightValue);
  7810. if (result.dp() > _config.Config.decimalPlaces) {
  7811. result = new _decimal2.default(result.toFixed(_config.Config.decimalPlaces));
  7812. }
  7813. return new _storeObject.StoreObject(resultType, result);
  7814. }
  7815. case _operators.Operators.GT.ord:
  7816. {
  7817. var _leftValue = left.value;
  7818. var _rightValue = right.value;
  7819. if (_types.Types.STRING.isCompatible(left.type)) {
  7820. result = left.value.length > right.value.length;
  7821. } else {
  7822. if (shouldImplicitCast) {
  7823. resultType = _types.Types.BOOLEAN;
  7824. _leftValue = _leftValue.trunc();
  7825. _rightValue = _rightValue.trunc();
  7826. }
  7827. result = _leftValue.gt(_rightValue);
  7828. }
  7829. return new _storeObject.StoreObject(resultType, result);
  7830. }
  7831. case _operators.Operators.GE.ord:
  7832. {
  7833. var _leftValue2 = left.value;
  7834. var _rightValue2 = right.value;
  7835. if (_types.Types.STRING.isCompatible(left.type)) {
  7836. result = left.value.length >= right.value.length;
  7837. } else {
  7838. if (shouldImplicitCast) {
  7839. resultType = _types.Types.BOOLEAN;
  7840. _leftValue2 = _leftValue2.trunc();
  7841. _rightValue2 = _rightValue2.trunc();
  7842. }
  7843. result = _leftValue2.gte(_rightValue2);
  7844. }
  7845. return new _storeObject.StoreObject(resultType, result);
  7846. }
  7847. case _operators.Operators.LT.ord:
  7848. {
  7849. var _leftValue3 = left.value;
  7850. var _rightValue3 = right.value;
  7851. if (_types.Types.STRING.isCompatible(left.type)) {
  7852. result = left.value.length < right.value.length;
  7853. } else {
  7854. if (shouldImplicitCast) {
  7855. resultType = _types.Types.BOOLEAN;
  7856. _leftValue3 = _leftValue3.trunc();
  7857. _rightValue3 = _rightValue3.trunc();
  7858. }
  7859. result = _leftValue3.lt(_rightValue3);
  7860. }
  7861. return new _storeObject.StoreObject(resultType, result);
  7862. }
  7863. case _operators.Operators.LE.ord:
  7864. {
  7865. var _leftValue4 = left.value;
  7866. var _rightValue4 = right.value;
  7867. if (_types.Types.STRING.isCompatible(left.type)) {
  7868. result = left.value.length <= right.value.length;
  7869. } else {
  7870. if (shouldImplicitCast) {
  7871. resultType = _types.Types.BOOLEAN;
  7872. _leftValue4 = _leftValue4.trunc();
  7873. _rightValue4 = _rightValue4.trunc();
  7874. }
  7875. result = _leftValue4.lte(_rightValue4);
  7876. }
  7877. return new _storeObject.StoreObject(resultType, result);
  7878. }
  7879. case _operators.Operators.EQ.ord:
  7880. {
  7881. var _leftValue5 = left.value;
  7882. var _rightValue5 = right.value;
  7883. if (_types.Types.INTEGER.isCompatible(left.type) || _types.Types.REAL.isCompatible(left.type)) {
  7884. if (shouldImplicitCast) {
  7885. resultType = _types.Types.BOOLEAN;
  7886. _leftValue5 = _leftValue5.trunc();
  7887. _rightValue5 = _rightValue5.trunc();
  7888. }
  7889. result = _leftValue5.eq(_rightValue5);
  7890. } else {
  7891. result = left.value === right.value;
  7892. }
  7893. return new _storeObject.StoreObject(resultType, result);
  7894. }
  7895. case _operators.Operators.NEQ.ord:
  7896. {
  7897. var _leftValue6 = left.value;
  7898. var _rightValue6 = right.value;
  7899. if (_types.Types.INTEGER.isCompatible(left.type) || _types.Types.REAL.isCompatible(left.type)) {
  7900. if (shouldImplicitCast) {
  7901. resultType = _types.Types.BOOLEAN;
  7902. _leftValue6 = _leftValue6.trunc();
  7903. _rightValue6 = _rightValue6.trunc();
  7904. }
  7905. result = !_leftValue6.eq(_rightValue6);
  7906. } else {
  7907. result = left.value !== right.value;
  7908. }
  7909. return new _storeObject.StoreObject(resultType, result);
  7910. }
  7911. case _operators.Operators.AND.ord:
  7912. return new _storeObject.StoreObject(resultType, left.value && right.value);
  7913. case _operators.Operators.OR.ord:
  7914. return new _storeObject.StoreObject(resultType, left.value || right.value);
  7915. default:
  7916. return Promise.reject(new _runtimeError.RuntimeError('!!!Critical Invalid InfixApp ' + infixApp.op));
  7917. }
  7918. });
  7919. }
  7920. }, {
  7921. key: 'parseStoreObjectValue',
  7922. value: function parseStoreObjectValue(vl) {
  7923. var realValue = vl;
  7924. if (vl instanceof _storeObjectArrayAddress.StoreObjectArrayAddress) {
  7925. if (vl.type instanceof _compoundType.CompoundType) {
  7926. switch (vl.type.dimensions) {
  7927. case 1:
  7928. {
  7929. realValue = new _storeObjectArray.StoreObjectArray(vl.type, vl.value);
  7930. break;
  7931. }
  7932. default:
  7933. {
  7934. throw new _runtimeError.RuntimeError("Three dimensional array address...");
  7935. }
  7936. }
  7937. } else {
  7938. realValue = new _storeObject.StoreObject(vl.type, vl.value);
  7939. }
  7940. }
  7941. return realValue;
  7942. }
  7943. }]);
  7944. return IVProgProcessor;
  7945. }();
  7946. /***/ }),
  7947. /***/ "./js/processor/lib/arrays.js":
  7948. /*!************************************!*\
  7949. !*** ./js/processor/lib/arrays.js ***!
  7950. \************************************/
  7951. /*! no static exports found */
  7952. /***/ (function(module, exports, __webpack_require__) {
  7953. "use strict";
  7954. Object.defineProperty(exports, "__esModule", {
  7955. value: true
  7956. });
  7957. exports.createNumElementsFun = createNumElementsFun;
  7958. exports.createMatrixLinesFun = createMatrixLinesFun;
  7959. exports.createMatrixColumnsFun = createMatrixColumnsFun;
  7960. var _storeObject = __webpack_require__(/*! ../store/storeObject */ "./js/processor/store/storeObject.js");
  7961. var _commands = __webpack_require__(/*! ./../../ast/commands */ "./js/ast/commands/index.js");
  7962. var Commands = _interopRequireWildcard(_commands);
  7963. var _types = __webpack_require__(/*! ./../../typeSystem/types */ "./js/typeSystem/types.js");
  7964. var _parsers = __webpack_require__(/*! ./../../typeSystem/parsers */ "./js/typeSystem/parsers.js");
  7965. var _compoundType = __webpack_require__(/*! ../../typeSystem/compoundType */ "./js/typeSystem/compoundType.js");
  7966. var _modes = __webpack_require__(/*! ../modes */ "./js/processor/modes.js");
  7967. 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; } }
  7968. /**
  7969. * num_elements
  7970. * matrix_lines
  7971. * matrix_columns
  7972. */
  7973. function createNumElementsFun() {
  7974. var numElementsFun = function numElementsFun(sto, _) {
  7975. var vector = sto.applyStore("vector");
  7976. var temp = new _storeObject.StoreObject(_types.Types.INTEGER, (0, _parsers.toInt)(vector.lines));
  7977. sto.mode = _modes.Modes.RETURN;
  7978. return Promise.resolve(sto.updateStore("$", temp));
  7979. };
  7980. var block = new Commands.CommandBlock([], [new Commands.SysCall(numElementsFun)]);
  7981. var func = new Commands.Function('$numElements', _types.Types.INTEGER, [new Commands.FormalParameter(new _compoundType.CompoundType(_types.Types.ALL, 1), 'vector', false)], block);
  7982. return func;
  7983. }
  7984. function createMatrixLinesFun() {
  7985. var matrixLinesFun = function matrixLinesFun(sto, _) {
  7986. var matrix = sto.applyStore("matrix");
  7987. var temp = new _storeObject.StoreObject(_types.Types.INTEGER, (0, _parsers.toInt)(matrix.lines));
  7988. sto.mode = _modes.Modes.RETURN;
  7989. return Promise.resolve(sto.updateStore("$", temp));
  7990. };
  7991. var block = new Commands.CommandBlock([], [new Commands.SysCall(matrixLinesFun)]);
  7992. var func = new Commands.Function('$matrixLines', _types.Types.INTEGER, [new Commands.FormalParameter(new _compoundType.CompoundType(_types.Types.ALL, 2), 'matrix', false)], block);
  7993. return func;
  7994. }
  7995. function createMatrixColumnsFun() {
  7996. var matrixColumnsFun = function matrixColumnsFun(sto, _) {
  7997. var matrix = sto.applyStore("matrix");
  7998. var temp = new _storeObject.StoreObject(_types.Types.INTEGER, (0, _parsers.toInt)(matrix.columns));
  7999. sto.mode = _modes.Modes.RETURN;
  8000. return Promise.resolve(sto.updateStore("$", temp));
  8001. };
  8002. var block = new Commands.CommandBlock([], [new Commands.SysCall(matrixColumnsFun)]);
  8003. var func = new Commands.Function('$matrixColumns', _types.Types.INTEGER, [new Commands.FormalParameter(new _compoundType.CompoundType(_types.Types.ALL, 2), 'matrix', false)], block);
  8004. return func;
  8005. }
  8006. /***/ }),
  8007. /***/ "./js/processor/lib/io.js":
  8008. /*!********************************!*\
  8009. !*** ./js/processor/lib/io.js ***!
  8010. \********************************/
  8011. /*! no static exports found */
  8012. /***/ (function(module, exports, __webpack_require__) {
  8013. "use strict";
  8014. Object.defineProperty(exports, "__esModule", {
  8015. value: true
  8016. });
  8017. exports.createOutputFun = createOutputFun;
  8018. exports.createInputFun = createInputFun;
  8019. var _storeObject = __webpack_require__(/*! ./../store/storeObject */ "./js/processor/store/storeObject.js");
  8020. var _commands = __webpack_require__(/*! ./../../ast/commands */ "./js/ast/commands/index.js");
  8021. var Commands = _interopRequireWildcard(_commands);
  8022. var _parsers = __webpack_require__(/*! ./../../typeSystem/parsers */ "./js/typeSystem/parsers.js");
  8023. var _types = __webpack_require__(/*! ./../../typeSystem/types */ "./js/typeSystem/types.js");
  8024. 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; } }
  8025. function createOutputFun() {
  8026. var writeFunction = function writeFunction(store, _) {
  8027. var val = store.applyStore('p1');
  8028. this.output.sendOutput((0, _parsers.convertToString)(val.value, val.type));
  8029. return Promise.resolve(store);
  8030. };
  8031. var block = new Commands.CommandBlock([], [new Commands.SysCall(writeFunction)]);
  8032. var func = new Commands.Function('$write', _types.Types.VOID, [new Commands.FormalParameter(_types.Types.ALL, 'p1', false)], block);
  8033. return func;
  8034. }
  8035. function createInputFun() {
  8036. var readFunction = function readFunction(store, _) {
  8037. var _this = this;
  8038. var request = new Promise(function (resolve, _) {
  8039. _this.input.requestInput(resolve);
  8040. });
  8041. return request.then(function (text) {
  8042. var typeToConvert = store.applyStore('p1').type;
  8043. var stoObj = null;
  8044. if (typeToConvert.isCompatible(_types.Types.INTEGER)) {
  8045. var val = (0, _parsers.toInt)(text);
  8046. stoObj = new _storeObject.StoreObject(_types.Types.INTEGER, val.trunc());
  8047. } else if (typeToConvert.isCompatible(_types.Types.REAL)) {
  8048. stoObj = new _storeObject.StoreObject(_types.Types.REAL, (0, _parsers.toReal)(text));
  8049. } else if (typeToConvert.isCompatible(_types.Types.BOOLEAN)) {
  8050. stoObj = new _storeObject.StoreObject(_types.Types.BOOLEAN, (0, _parsers.toBool)(text));
  8051. } else if (typeToConvert.isCompatible(_types.Types.STRING)) {
  8052. stoObj = new _storeObject.StoreObject(_types.Types.STRING, (0, _parsers.toString)(text));
  8053. }
  8054. _this.loopTimers.splice(0, _this.loopTimers.length);
  8055. store.updateStore('p1', stoObj);
  8056. return Promise.resolve(store);
  8057. });
  8058. };
  8059. var block = new Commands.CommandBlock([], [new Commands.SysCall(readFunction)]);
  8060. var func = new Commands.Function('$read', _types.Types.VOID, [new Commands.FormalParameter(_types.Types.ALL, 'p1', true)], block);
  8061. return func;
  8062. }
  8063. /***/ }),
  8064. /***/ "./js/processor/lib/lang.js":
  8065. /*!**********************************!*\
  8066. !*** ./js/processor/lib/lang.js ***!
  8067. \**********************************/
  8068. /*! no static exports found */
  8069. /***/ (function(module, exports, __webpack_require__) {
  8070. "use strict";
  8071. Object.defineProperty(exports, "__esModule", {
  8072. value: true
  8073. });
  8074. exports.createIsRealFun = createIsRealFun;
  8075. exports.createIsIntFun = createIsIntFun;
  8076. exports.createIsBoolFun = createIsBoolFun;
  8077. exports.createCastRealFun = createCastRealFun;
  8078. exports.createCastIntFun = createCastIntFun;
  8079. exports.createCastBoolFun = createCastBoolFun;
  8080. exports.createCastStringFun = createCastStringFun;
  8081. var _storeObject = __webpack_require__(/*! ../store/storeObject */ "./js/processor/store/storeObject.js");
  8082. var _commands = __webpack_require__(/*! ./../../ast/commands */ "./js/ast/commands/index.js");
  8083. var Commands = _interopRequireWildcard(_commands);
  8084. var _types = __webpack_require__(/*! ./../../typeSystem/types */ "./js/typeSystem/types.js");
  8085. var _parsers = __webpack_require__(/*! ./../../typeSystem/parsers */ "./js/typeSystem/parsers.js");
  8086. var _ivprogParser = __webpack_require__(/*! ../../ast/ivprogParser */ "./js/ast/ivprogParser.js");
  8087. var _expressions = __webpack_require__(/*! ../../ast/expressions */ "./js/ast/expressions/index.js");
  8088. var _modes = __webpack_require__(/*! ../modes */ "./js/processor/modes.js");
  8089. 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; } }
  8090. /**
  8091. *
  8092. * is_real
  8093. * is_int
  8094. * is_bool
  8095. * cast_real
  8096. * cast_int
  8097. * cast_bool
  8098. * cast_string
  8099. */
  8100. function createIsRealFun() {
  8101. var isRealFun = function isRealFun(sto, _) {
  8102. var str = sto.applyStore("str");
  8103. var parser = _ivprogParser.IVProgParser.createParser(str.value);
  8104. var result = false;
  8105. try {
  8106. var val = parser.parseTerm();
  8107. if (val instanceof _expressions.RealLiteral) {
  8108. result = true;
  8109. }
  8110. } catch (error) {}
  8111. var temp = new _storeObject.StoreObject(_types.Types.BOOLEAN, result);
  8112. sto.mode = _modes.Modes.RETURN;
  8113. return Promise.resolve(sto.updateStore("$", temp));
  8114. };
  8115. var block = new Commands.CommandBlock([], [new Commands.SysCall(isRealFun)]);
  8116. var func = new Commands.Function('$isReal', _types.Types.BOOLEAN, [new Commands.FormalParameter(_types.Types.STRING, 'str', false)], block);
  8117. return func;
  8118. }
  8119. function createIsIntFun() {
  8120. var isIntFun = function isIntFun(sto, _) {
  8121. var str = sto.applyStore("str");
  8122. var parser = _ivprogParser.IVProgParser.createParser(str.value);
  8123. var result = false;
  8124. try {
  8125. var val = parser.parseTerm();
  8126. if (val instanceof _expressions.IntLiteral) {
  8127. result = true;
  8128. }
  8129. } catch (error) {}
  8130. var temp = new _storeObject.StoreObject(_types.Types.BOOLEAN, result);
  8131. sto.mode = _modes.Modes.RETURN;
  8132. return Promise.resolve(sto.updateStore("$", temp));
  8133. };
  8134. var block = new Commands.CommandBlock([], [new Commands.SysCall(isIntFun)]);
  8135. var func = new Commands.Function('$isInt', _types.Types.BOOLEAN, [new Commands.FormalParameter(_types.Types.STRING, 'str', false)], block);
  8136. return func;
  8137. }
  8138. function createIsBoolFun() {
  8139. var isBoolFun = function isBoolFun(sto, _) {
  8140. var str = sto.applyStore("str");
  8141. var parser = _ivprogParser.IVProgParser.createParser(str.value);
  8142. var result = false;
  8143. try {
  8144. var val = parser.parseTerm();
  8145. if (val instanceof _expressions.BoolLiteral) {
  8146. result = true;
  8147. }
  8148. } catch (error) {}
  8149. var temp = new _storeObject.StoreObject(_types.Types.BOOLEAN, result);
  8150. sto.mode = _modes.Modes.RETURN;
  8151. return Promise.resolve(sto.updateStore("$", temp));
  8152. };
  8153. var block = new Commands.CommandBlock([], [new Commands.SysCall(isBoolFun)]);
  8154. var func = new Commands.Function('$isBool', _types.Types.BOOLEAN, [new Commands.FormalParameter(_types.Types.STRING, 'str', false)], block);
  8155. return func;
  8156. }
  8157. function createCastRealFun() {
  8158. var castRealFun = function castRealFun(sto, _) {
  8159. var val = sto.applyStore("val");
  8160. switch (val.type.ord) {
  8161. case _types.Types.INTEGER.ord:
  8162. {
  8163. var temp = new _storeObject.StoreObject(_types.Types.REAL, (0, _parsers.toReal)(val.number));
  8164. sto.mode = _modes.Modes.RETURN;
  8165. return Promise.resolve(sto.updateStore("$", temp));
  8166. }
  8167. case _types.Types.STRING.ord:
  8168. {
  8169. var parser = _ivprogParser.IVProgParser.createParser(val.value);
  8170. try {
  8171. var result = parser.parseTerm();
  8172. if (result instanceof _expressions.RealLiteral) {
  8173. var _temp = new _storeObject.StoreObject(_types.Types.REAL, result.value);
  8174. sto.mode = _modes.Modes.RETURN;
  8175. return Promise.resolve(sto.updateStore("$", _temp));
  8176. }
  8177. } catch (error) {
  8178. return Promise.reject("cannot convert string to real");
  8179. }
  8180. }
  8181. }
  8182. };
  8183. var block = new Commands.CommandBlock([], [new Commands.SysCall(castRealFun)]);
  8184. var func = new Commands.Function('$castReal', _types.Types.REAL, [new Commands.FormalParameter(_types.Types.ALL, 'val', false)], block);
  8185. return func;
  8186. }
  8187. function createCastIntFun() {
  8188. var castIntFun = function castIntFun(sto, _) {
  8189. var val = sto.applyStore("val");
  8190. switch (val.type.ord) {
  8191. case _types.Types.REAL.ord:
  8192. {
  8193. var temp = new _storeObject.StoreObject(_types.Types.INTEGER, Math.floor(val.number));
  8194. sto.mode = _modes.Modes.RETURN;
  8195. return Promise.resolve(sto.updateStore("$", temp));
  8196. }
  8197. case _types.Types.STRING.ord:
  8198. {
  8199. var parser = _ivprogParser.IVProgParser.createParser(val.value);
  8200. try {
  8201. var result = parser.parseTerm();
  8202. if (result instanceof _expressions.IntLiteral) {
  8203. var _temp2 = new _storeObject.StoreObject(_types.Types.INTEGER, result.value);
  8204. sto.mode = _modes.Modes.RETURN;
  8205. return Promise.resolve(sto.updateStore("$", _temp2));
  8206. }
  8207. } catch (error) {
  8208. return Promise.reject("cannot convert string to real");
  8209. }
  8210. }
  8211. }
  8212. };
  8213. var block = new Commands.CommandBlock([], [new Commands.SysCall(castIntFun)]);
  8214. var func = new Commands.Function('$castInt', _types.Types.INTEGER, [new Commands.FormalParameter(_types.Types.ALL, 'val', false)], block);
  8215. return func;
  8216. }
  8217. function createCastBoolFun() {
  8218. var castBoolFun = function castBoolFun(sto, _) {
  8219. var str = sto.applyStore("str");
  8220. var parser = _ivprogParser.IVProgParser.createParser(str.value);
  8221. try {
  8222. var val = parser.parseTerm();
  8223. if (val instanceof _expressions.BoolLiteral) {
  8224. var temp = new _storeObject.StoreObject(_types.Types.BOOLEAN, val.value);
  8225. sto.mode = _modes.Modes.RETURN;
  8226. return Promise.resolve(sto.updateStore("$", temp));
  8227. }
  8228. } catch (error) {}
  8229. return Promise.reject("cannot convert " + str.value + " to boolean");
  8230. };
  8231. var block = new Commands.CommandBlock([], [new Commands.SysCall(castBoolFun)]);
  8232. var func = new Commands.Function('$castBool', _types.Types.BOOLEAN, [new Commands.FormalParameter(_types.Types.STRING, 'str', false)], block);
  8233. return func;
  8234. }
  8235. function createCastStringFun() {
  8236. var castStringFun = function castStringFun(store, _) {
  8237. var val = store.applyStore('str');
  8238. var result = (0, _parsers.convertToString)(val);
  8239. var temp = new _storeObject.StoreObject(_types.Types.STRING, result);
  8240. sto.mode = _modes.Modes.RETURN;
  8241. return Promise.resolve(sto.updateStore("$", temp));
  8242. };
  8243. var block = new Commands.CommandBlock([], [new Commands.SysCall(castStringFun)]);
  8244. var func = new Commands.Function('$castString', _types.Types.STRING, [new Commands.FormalParameter(_types.Types.ALL, 'str', false)], block);
  8245. return func;
  8246. }
  8247. /***/ }),
  8248. /***/ "./js/processor/lib/math.js":
  8249. /*!**********************************!*\
  8250. !*** ./js/processor/lib/math.js ***!
  8251. \**********************************/
  8252. /*! no static exports found */
  8253. /***/ (function(module, exports, __webpack_require__) {
  8254. "use strict";
  8255. Object.defineProperty(exports, "__esModule", {
  8256. value: true
  8257. });
  8258. exports.createSinFun = createSinFun;
  8259. exports.createCosFun = createCosFun;
  8260. exports.createTanFun = createTanFun;
  8261. exports.createSqrtFun = createSqrtFun;
  8262. exports.createPowFun = createPowFun;
  8263. exports.createLogFun = createLogFun;
  8264. exports.createAbsFun = createAbsFun;
  8265. exports.createNegateFun = createNegateFun;
  8266. exports.createInvertFun = createInvertFun;
  8267. exports.createMaxFun = createMaxFun;
  8268. exports.createMinFun = createMinFun;
  8269. var _storeObject = __webpack_require__(/*! ../store/storeObject */ "./js/processor/store/storeObject.js");
  8270. var _commands = __webpack_require__(/*! ./../../ast/commands */ "./js/ast/commands/index.js");
  8271. var Commands = _interopRequireWildcard(_commands);
  8272. var _types = __webpack_require__(/*! ./../../typeSystem/types */ "./js/typeSystem/types.js");
  8273. var _parsers = __webpack_require__(/*! ./../../typeSystem/parsers */ "./js/typeSystem/parsers.js");
  8274. var _decimal = __webpack_require__(/*! decimal.js */ "./node_modules/decimal.js/decimal.js");
  8275. var _multiType = __webpack_require__(/*! ../../typeSystem/multiType */ "./js/typeSystem/multiType.js");
  8276. var _compoundType = __webpack_require__(/*! ../../typeSystem/compoundType */ "./js/typeSystem/compoundType.js");
  8277. var _modes = __webpack_require__(/*! ../modes */ "./js/processor/modes.js");
  8278. var _config = __webpack_require__(/*! ../../util/config */ "./js/util/config.js");
  8279. 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; } }
  8280. 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); } }
  8281. /**
  8282. * sin
  8283. * cos
  8284. * tan
  8285. * sqrt
  8286. * pow
  8287. * log
  8288. * abs
  8289. * negate
  8290. * invert
  8291. * max
  8292. * min
  8293. */
  8294. function convertToRadians(degrees) {
  8295. return degrees.times(_decimal.Decimal.acos(-1)).div(180);
  8296. }
  8297. function createSinFun() {
  8298. var sinFun = function sinFun(sto, _) {
  8299. var x = sto.applyStore('x');
  8300. var angle = x.value.mod(360);
  8301. var result = null;
  8302. if (angle.eq(90)) {
  8303. result = new _decimal.Decimal(1);
  8304. } else if (angle.eq(180)) {
  8305. result = new _decimal.Decimal(0);
  8306. } else if (angle.eq(270)) {
  8307. result = new _decimal.Decimal(-1);
  8308. } else {
  8309. result = _decimal.Decimal.sin(convertToRadians(angle));
  8310. }
  8311. if (result.dp() > _config.Config.decimalPlaces) {
  8312. result = new _decimal.Decimal(result.toFixed(_config.Config.decimalPlaces));
  8313. }
  8314. var temp = new _storeObject.StoreObject(_types.Types.REAL, result);
  8315. sto.mode = _modes.Modes.RETURN;
  8316. return Promise.resolve(sto.updateStore('$', temp));
  8317. };
  8318. var block = new Commands.CommandBlock([], [new Commands.SysCall(sinFun)]);
  8319. var func = new Commands.Function('$sin', _types.Types.REAL, [new Commands.FormalParameter(new _multiType.MultiType([_types.Types.INTEGER, _types.Types.REAL]), 'x', false)], block);
  8320. return func;
  8321. }
  8322. function createCosFun() {
  8323. var cosFun = function cosFun(sto, _) {
  8324. var x = sto.applyStore('x');
  8325. var angle = x.value.mod(360);
  8326. var result = null;
  8327. if (angle.eq(90)) {
  8328. result = new _decimal.Decimal(0);
  8329. } else if (angle.eq(180)) {
  8330. result = new _decimal.Decimal(-1);
  8331. } else if (angle.eq(270)) {
  8332. result = new _decimal.Decimal(0);
  8333. }
  8334. result = _decimal.Decimal.cos(convertToRadians(angle));
  8335. if (result.dp() > _config.Config.decimalPlaces) {
  8336. result = new _decimal.Decimal(result.toFixed(_config.Config.decimalPlaces));
  8337. }
  8338. var temp = new _storeObject.StoreObject(_types.Types.REAL, result);
  8339. sto.mode = _modes.Modes.RETURN;
  8340. return Promise.resolve(sto.updateStore('$', temp));
  8341. };
  8342. var block = new Commands.CommandBlock([], [new Commands.SysCall(cosFun)]);
  8343. var func = new Commands.Function('$cos', _types.Types.REAL, [new Commands.FormalParameter(new _multiType.MultiType([_types.Types.INTEGER, _types.Types.REAL]), 'x', false)], block);
  8344. return func;
  8345. }
  8346. function createTanFun() {
  8347. var tanFun = function tanFun(sto, _) {
  8348. var x = sto.applyStore('x');
  8349. var angle = x.value.mod(360);
  8350. if (angle.eq(90) || angle.eq(270)) {
  8351. return Promise.reject("Tangent of " + x.value.toNumber() + "° is undefined.");
  8352. }
  8353. var result = _decimal.Decimal.tan(convertToRadians(angle));
  8354. if (result.dp() > _config.Config.decimalPlaces) {
  8355. result = new _decimal.Decimal(result.toFixed(_config.Config.decimalPlaces));
  8356. }
  8357. var temp = new _storeObject.StoreObject(_types.Types.REAL, result);
  8358. sto.mode = _modes.Modes.RETURN;
  8359. return Promise.resolve(sto.updateStore('$', temp));
  8360. };
  8361. var block = new Commands.CommandBlock([], [new Commands.SysCall(tanFun)]);
  8362. var func = new Commands.Function('$tan', _types.Types.REAL, [new Commands.FormalParameter(new _multiType.MultiType([_types.Types.INTEGER, _types.Types.REAL]), 'x', false)], block);
  8363. return func;
  8364. }
  8365. function createSqrtFun() {
  8366. var sqrtFun = function sqrtFun(sto, _) {
  8367. var x = sto.applyStore('x');
  8368. var result = x.value.sqrt();
  8369. if (result.dp() > _config.Config.decimalPlaces) {
  8370. result = new _decimal.Decimal(result.toFixed(_config.Config.decimalPlaces));
  8371. }
  8372. var temp = new _storeObject.StoreObject(_types.Types.REAL, result);
  8373. sto.mode = _modes.Modes.RETURN;
  8374. return Promise.resolve(sto.updateStore('$', temp));
  8375. };
  8376. var block = new Commands.CommandBlock([], [new Commands.SysCall(sqrtFun)]);
  8377. var func = new Commands.Function('$sqrt', _types.Types.REAL, [new Commands.FormalParameter(new _multiType.MultiType([_types.Types.INTEGER, _types.Types.REAL]), 'x', false)], block);
  8378. return func;
  8379. }
  8380. function createPowFun() {
  8381. var powFun = function powFun(sto, _) {
  8382. var x = sto.applyStore('x');
  8383. var y = sto.applyStore('y');
  8384. var result = x.value.pow(y.value);
  8385. if (result.dp() > _config.Config.decimalPlaces) {
  8386. result = new _decimal.Decimal(result.toFixed(_config.Config.decimalPlaces));
  8387. }
  8388. var temp = new _storeObject.StoreObject(_types.Types.REAL, result);
  8389. sto.mode = _modes.Modes.RETURN;
  8390. return Promise.resolve(sto.updateStore('$', temp));
  8391. };
  8392. var block = new Commands.CommandBlock([], [new Commands.SysCall(powFun)]);
  8393. 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);
  8394. return func;
  8395. }
  8396. function createLogFun() {
  8397. var logFun = function logFun(sto, _) {
  8398. var x = sto.applyStore('x');
  8399. if (x.value.isNegative()) {
  8400. return Promise.reject("the value passed to log function cannot be negative");
  8401. }
  8402. var result = _decimal.Decimal.log10(x.value);
  8403. if (result.dp() > _config.Config.decimalPlaces) {
  8404. result = new _decimal.Decimal(result.toFixed(_config.Config.decimalPlaces));
  8405. }
  8406. var temp = new _storeObject.StoreObject(_types.Types.REAL, result);
  8407. sto.mode = _modes.Modes.RETURN;
  8408. return Promise.resolve(sto.updateStore('$', temp));
  8409. };
  8410. var block = new Commands.CommandBlock([], [new Commands.SysCall(logFun)]);
  8411. var func = new Commands.Function('$log', _types.Types.REAL, [new Commands.FormalParameter(new _multiType.MultiType([_types.Types.INTEGER, _types.Types.REAL]), 'x', false)], block);
  8412. return func;
  8413. }
  8414. function createAbsFun() {
  8415. var absFun = function absFun(sto, _) {
  8416. var x = sto.applyStore('x');
  8417. var result = x.value.abs();
  8418. var temp = new _storeObject.StoreObject(x.type, result);
  8419. sto.mode = _modes.Modes.RETURN;
  8420. return Promise.resolve(sto.updateStore('$', temp));
  8421. };
  8422. var block = new Commands.CommandBlock([], [new Commands.SysCall(absFun)]);
  8423. 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);
  8424. return func;
  8425. }
  8426. function createNegateFun() {
  8427. var negateFun = function negateFun(sto, _) {
  8428. var x = sto.applyStore('x');
  8429. var result = x.value.negated();
  8430. var temp = new _storeObject.StoreObject(x.type, result);
  8431. sto.mode = _modes.Modes.RETURN;
  8432. return Promise.resolve(sto.updateStore('$', temp));
  8433. };
  8434. var block = new Commands.CommandBlock([], [new Commands.SysCall(negateFun)]);
  8435. 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);
  8436. return func;
  8437. }
  8438. function createInvertFun() {
  8439. var invertFun = function invertFun(sto, _) {
  8440. var x = sto.applyStore('x');
  8441. var result = (0, _parsers.toReal)(1).dividedBy(x.value);
  8442. if (result.dp() > _config.Config.decimalPlaces) {
  8443. result = new _decimal.Decimal(result.toFixed(_config.Config.decimalPlaces));
  8444. }
  8445. var temp = new _storeObject.StoreObject(_types.Types.REAL, result);
  8446. sto.mode = _modes.Modes.RETURN;
  8447. return Promise.resolve(sto.updateStore('$', temp));
  8448. };
  8449. var block = new Commands.CommandBlock([], [new Commands.SysCall(invertFun)]);
  8450. var func = new Commands.Function('$invert', _types.Types.REAL, [new Commands.FormalParameter(new _multiType.MultiType([_types.Types.INTEGER, _types.Types.REAL]), 'x', false)], block);
  8451. return func;
  8452. }
  8453. function createMaxFun() {
  8454. var maxFun = function maxFun(sto, _) {
  8455. var x = sto.applyStore('x');
  8456. var numbers = x.value.map(function (stoObj) {
  8457. return stoObj.value;
  8458. });
  8459. var result = _decimal.Decimal.max.apply(_decimal.Decimal, _toConsumableArray(numbers));
  8460. var temp = new _storeObject.StoreObject(x.type.innerType, result);
  8461. sto.mode = _modes.Modes.RETURN;
  8462. return Promise.resolve(sto.updateStore('$', temp));
  8463. };
  8464. var paramType = new _compoundType.CompoundType(new _multiType.MultiType([_types.Types.INTEGER, _types.Types.REAL]), 1);
  8465. var block = new Commands.CommandBlock([], [new Commands.SysCall(maxFun)]);
  8466. var func = new Commands.Function('$max', new _multiType.MultiType([_types.Types.INTEGER, _types.Types.REAL]), [new Commands.FormalParameter(paramType, 'x', false)], block);
  8467. return func;
  8468. }
  8469. function createMinFun() {
  8470. var minFun = function minFun(sto, _) {
  8471. var x = sto.applyStore('x');
  8472. var numbers = x.value.map(function (stoObj) {
  8473. return stoObj.value;
  8474. });
  8475. var result = _decimal.Decimal.min.apply(_decimal.Decimal, _toConsumableArray(numbers));
  8476. var temp = new _storeObject.StoreObject(x.type.innerType, result);
  8477. sto.mode = _modes.Modes.RETURN;
  8478. return Promise.resolve(sto.updateStore('$', temp));
  8479. };
  8480. var paramType = new _compoundType.CompoundType(new _multiType.MultiType([_types.Types.INTEGER, _types.Types.REAL]), 1);
  8481. var block = new Commands.CommandBlock([], [new Commands.SysCall(minFun)]);
  8482. var func = new Commands.Function('$min', new _multiType.MultiType([_types.Types.INTEGER, _types.Types.REAL]), [new Commands.FormalParameter(paramType, 'x', false)], block);
  8483. return func;
  8484. }
  8485. /***/ }),
  8486. /***/ "./js/processor/lib/strings.js":
  8487. /*!*************************************!*\
  8488. !*** ./js/processor/lib/strings.js ***!
  8489. \*************************************/
  8490. /*! no static exports found */
  8491. /***/ (function(module, exports, __webpack_require__) {
  8492. "use strict";
  8493. Object.defineProperty(exports, "__esModule", {
  8494. value: true
  8495. });
  8496. exports.createSubstringFun = createSubstringFun;
  8497. exports.createLengthFun = createLengthFun;
  8498. exports.createUppercaseFun = createUppercaseFun;
  8499. exports.createLowercaseFun = createLowercaseFun;
  8500. exports.createrCharAtFun = createrCharAtFun;
  8501. var _storeObject = __webpack_require__(/*! ../store/storeObject */ "./js/processor/store/storeObject.js");
  8502. var _commands = __webpack_require__(/*! ./../../ast/commands */ "./js/ast/commands/index.js");
  8503. var Commands = _interopRequireWildcard(_commands);
  8504. var _types = __webpack_require__(/*! ./../../typeSystem/types */ "./js/typeSystem/types.js");
  8505. var _parsers = __webpack_require__(/*! ./../../typeSystem/parsers */ "./js/typeSystem/parsers.js");
  8506. var _modes = __webpack_require__(/*! ../modes */ "./js/processor/modes.js");
  8507. 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; } }
  8508. /*
  8509. * substring
  8510. * length
  8511. * uppercase
  8512. * lowercase
  8513. * charAt
  8514. **/
  8515. function createSubstringFun() {
  8516. var substringFun = function substringFun(sto, _) {
  8517. var str = sto.applyStore("str");
  8518. var start = sto.applyStore("start");
  8519. var end = sto.applyStore("end");
  8520. var result = str.value.substring(start.value, end.value);
  8521. var temp = new _storeObject.StoreObject(_types.Types.STRING, result);
  8522. sto.mode = _modes.Modes.RETURN;
  8523. return Promise.resolve(sto.updateStore("$", temp));
  8524. };
  8525. var block = new Commands.CommandBlock([], [new Commands.SysCall(substringFun)]);
  8526. 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);
  8527. return func;
  8528. }
  8529. function createLengthFun() {
  8530. var lengthFun = function lengthFun(sto, _) {
  8531. var str = sto.applyStore("str");
  8532. var temp = new _storeObject.StoreObject(_types.Types.INTEGER, (0, _parsers.toInt)(str.value.length));
  8533. sto.mode = _modes.Modes.RETURN;
  8534. return Promise.resolve(sto.updateStore("$", temp));
  8535. };
  8536. var block = new Commands.CommandBlock([], [new Commands.SysCall(lengthFun)]);
  8537. var func = new Commands.Function('$length', _types.Types.INTEGER, [new Commands.FormalParameter(_types.Types.STRING, 'str', false)], block);
  8538. return func;
  8539. }
  8540. function createUppercaseFun() {
  8541. var uppercaseFun = function uppercaseFun(sto, _) {
  8542. var str = sto.applyStore("str");
  8543. var temp = new _storeObject.StoreObject(_types.Types.STRING, str.value.toUpperCase());
  8544. sto.mode = _modes.Modes.RETURN;
  8545. return Promise.resolve(sto.updateStore("$", temp));
  8546. };
  8547. var block = new Commands.CommandBlock([], [new Commands.SysCall(uppercaseFun)]);
  8548. var func = new Commands.Function('$uppercase', _types.Types.STRING, [new Commands.FormalParameter(_types.Types.STRING, 'str', false)], block);
  8549. return func;
  8550. }
  8551. function createLowercaseFun() {
  8552. var lowercaseFun = function lowercaseFun(sto, _) {
  8553. var str = sto.applyStore("str");
  8554. var temp = new _storeObject.StoreObject(_types.Types.STRING, str.value.toLowerCase());
  8555. sto.mode = _modes.Modes.RETURN;
  8556. return Promise.resolve(sto.updateStore("$", temp));
  8557. };
  8558. var block = new Commands.CommandBlock([], [new Commands.SysCall(lowercaseFun)]);
  8559. var func = new Commands.Function('$lowercase', _types.Types.STRING, [new Commands.FormalParameter(_types.Types.STRING, 'str', false)], block);
  8560. return func;
  8561. }
  8562. function createrCharAtFun() {
  8563. var charAtFun = function charAtFun(sto, _) {
  8564. var str = sto.applyStore("str");
  8565. var idx = sto.applyStore("index");
  8566. if (idx.value.toNumber() < 0 || idx.value.toNumber() >= str.value.length) {
  8567. return Promise.reject(new Error("invalid string position"));
  8568. }
  8569. var temp = new _storeObject.StoreObject(_types.Types.STRING, str.value.charAt(idx.value.toNumber()));
  8570. sto.mode = _modes.Modes.RETURN;
  8571. return Promise.resolve(sto.updateStore("$", temp));
  8572. };
  8573. var block = new Commands.CommandBlock([], [new Commands.SysCall(charAtFun)]);
  8574. 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);
  8575. return func;
  8576. }
  8577. /***/ }),
  8578. /***/ "./js/processor/modes.js":
  8579. /*!*******************************!*\
  8580. !*** ./js/processor/modes.js ***!
  8581. \*******************************/
  8582. /*! no static exports found */
  8583. /***/ (function(module, exports, __webpack_require__) {
  8584. "use strict";
  8585. Object.defineProperty(exports, "__esModule", {
  8586. value: true
  8587. });
  8588. var Modes = exports.Modes = Object.freeze({
  8589. RETURN: Symbol('mode:return'),
  8590. BREAK: Symbol('mode:break'),
  8591. PAUSE: Symbol('mode:pause'),
  8592. RUN: Symbol('mode:run')
  8593. });
  8594. /***/ }),
  8595. /***/ "./js/processor/semantic/semanticAnalyser.js":
  8596. /*!***************************************************!*\
  8597. !*** ./js/processor/semantic/semanticAnalyser.js ***!
  8598. \***************************************************/
  8599. /*! no static exports found */
  8600. /***/ (function(module, exports, __webpack_require__) {
  8601. "use strict";
  8602. Object.defineProperty(exports, "__esModule", {
  8603. value: true
  8604. });
  8605. exports.SemanticAnalyser = undefined;
  8606. 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; }; }();
  8607. var _processorErrorFactory = __webpack_require__(/*! ./../error/processorErrorFactory */ "./js/processor/error/processorErrorFactory.js");
  8608. var _definedFunctions = __webpack_require__(/*! ./../definedFunctions */ "./js/processor/definedFunctions.js");
  8609. var _languageService = __webpack_require__(/*! ./../../services/languageService */ "./js/services/languageService.js");
  8610. var _commands = __webpack_require__(/*! ../../ast/commands */ "./js/ast/commands/index.js");
  8611. var _expressions = __webpack_require__(/*! ../../ast/expressions */ "./js/ast/expressions/index.js");
  8612. var _literal = __webpack_require__(/*! ../../ast/expressions/literal */ "./js/ast/expressions/literal.js");
  8613. var _compatibilityTable = __webpack_require__(/*! ../compatibilityTable */ "./js/processor/compatibilityTable.js");
  8614. var _types = __webpack_require__(/*! ../../typeSystem/types */ "./js/typeSystem/types.js");
  8615. var _compoundType = __webpack_require__(/*! ../../typeSystem/compoundType */ "./js/typeSystem/compoundType.js");
  8616. var _multiType = __webpack_require__(/*! ../../typeSystem/multiType */ "./js/typeSystem/multiType.js");
  8617. var _config = __webpack_require__(/*! ../../util/config */ "./js/util/config.js");
  8618. var _store = __webpack_require__(/*! ../store/store */ "./js/processor/store/store.js");
  8619. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  8620. var SemanticAnalyser = exports.SemanticAnalyser = function () {
  8621. function SemanticAnalyser(ast) {
  8622. _classCallCheck(this, SemanticAnalyser);
  8623. this.ast = ast;
  8624. this.lexerClass = _languageService.LanguageService.getCurrentLexer();
  8625. var lexer = new this.lexerClass(null);
  8626. this.literalNames = lexer.literalNames;
  8627. this.symbolMap = null;
  8628. this.currentFunction = null;
  8629. }
  8630. _createClass(SemanticAnalyser, [{
  8631. key: 'pushMap',
  8632. value: function pushMap() {
  8633. if (this.symbolMap === null) {
  8634. this.symbolMap = { map: {}, next: null };
  8635. } else {
  8636. var n = { map: {}, next: this.symbolMap };
  8637. this.symbolMap = n;
  8638. }
  8639. }
  8640. }, {
  8641. key: 'popMap',
  8642. value: function popMap() {
  8643. if (this.symbolMap !== null) {
  8644. this.symbolMap = this.symbolMap.next;
  8645. }
  8646. }
  8647. }, {
  8648. key: 'insertSymbol',
  8649. value: function insertSymbol(id, typeInfo) {
  8650. this.symbolMap.map[id] = typeInfo;
  8651. }
  8652. }, {
  8653. key: 'findSymbol',
  8654. value: function findSymbol(id, symMap) {
  8655. if (!symMap.map[id]) {
  8656. if (symMap.next) {
  8657. return this.findSymbol(id, symMap.next);
  8658. }
  8659. return null;
  8660. } else {
  8661. return symMap.map[id];
  8662. }
  8663. }
  8664. }, {
  8665. key: 'getMainFunction',
  8666. value: function getMainFunction() {
  8667. return this.ast.functions.find(function (v) {
  8668. return v.isMain;
  8669. });
  8670. }
  8671. }, {
  8672. key: 'findFunction',
  8673. value: function findFunction(name) {
  8674. console.log(name);
  8675. if (name.match(/^\$.+$/)) {
  8676. var fun = _definedFunctions.LanguageDefinedFunction.getFunction(name);
  8677. if (!!!fun) {
  8678. throw _processorErrorFactory.ProcessorErrorFactory.not_implemented(name);
  8679. }
  8680. return fun;
  8681. } else {
  8682. var val = this.ast.functions.find(function (v) {
  8683. return v.name === name;
  8684. });
  8685. if (!!!val) {
  8686. return null;
  8687. }
  8688. return val;
  8689. }
  8690. }
  8691. }, {
  8692. key: 'analyseTree',
  8693. value: function analyseTree() {
  8694. var globalVars = this.ast.global;
  8695. this.pushMap();
  8696. this.assertDeclarations(globalVars);
  8697. var functions = this.ast.functions;
  8698. var mainFunc = functions.filter(function (f) {
  8699. return f.name === null;
  8700. });
  8701. if (mainFunc.length <= 0) {
  8702. throw _processorErrorFactory.ProcessorErrorFactory.main_missing();
  8703. }
  8704. for (var i = 0; i < functions.length; i++) {
  8705. var fun = functions[i];
  8706. this.assertFunction(fun);
  8707. }
  8708. return this.ast;
  8709. }
  8710. }, {
  8711. key: 'assertDeclarations',
  8712. value: function assertDeclarations(list) {
  8713. for (var i = 0; i < list.length; i++) {
  8714. this.assertDeclaration(list[i]);
  8715. }
  8716. }
  8717. }, {
  8718. key: 'assertDeclaration',
  8719. value: function assertDeclaration(declaration) {
  8720. if (declaration instanceof _commands.ArrayDeclaration) {
  8721. if (declaration.initial === null) {
  8722. var lineType = this.evaluateExpressionType(declaration.lines);
  8723. if (!lineType.isCompatible(_types.Types.INTEGER)) {
  8724. throw _processorErrorFactory.ProcessorErrorFactory.array_dimension_not_int_full(declaration.sourceInfo);
  8725. }
  8726. if (declaration.columns !== null) {
  8727. var columnType = this.evaluateExpressionType(declaration.columns);
  8728. if (!columnType.isCompatible(_types.Types.INTEGER)) {
  8729. throw _processorErrorFactory.ProcessorErrorFactory.array_dimension_not_int_full(declaration.sourceInfo);
  8730. }
  8731. }
  8732. this.insertSymbol(declaration.id, { id: declaration.id, lines: declaration.lines, columns: declaration.columns, type: declaration.type });
  8733. return;
  8734. }
  8735. this.evaluateArrayLiteral(declaration.id, declaration.lines, declaration.columns, declaration.type, declaration.initial);
  8736. this.insertSymbol(declaration.id, { id: declaration.id, lines: declaration.lines, columns: declaration.columns, type: declaration.type });
  8737. } else {
  8738. if (declaration.initial === null) {
  8739. this.insertSymbol(declaration.id, { id: declaration.id, type: declaration.type });
  8740. return;
  8741. }
  8742. var resultType = this.evaluateExpressionType(declaration.initial);
  8743. if (resultType instanceof _multiType.MultiType) {
  8744. if (!resultType.isCompatible(declaration.type)) {
  8745. var stringInfo = declaration.type.stringInfo();
  8746. var info = stringInfo[0];
  8747. throw _processorErrorFactory.ProcessorErrorFactory.incompatible_types_full(info.type, info.dim, declaration.sourceInfo);
  8748. }
  8749. this.insertSymbol(declaration.id, { id: declaration.id, type: declaration.type });
  8750. } else if (!declaration.type.isCompatible(resultType) && !_config.Config.enable_type_casting || !declaration.type.isCompatible(resultType) && _config.Config.enable_type_casting && !_store.Store.canImplicitTypeCast(declaration.type, resultType)) {
  8751. var _stringInfo = declaration.type.stringInfo();
  8752. var _info = _stringInfo[0];
  8753. throw _processorErrorFactory.ProcessorErrorFactory.incompatible_types_full(_info.type, _info.dim, declaration.sourceInfo);
  8754. } else {
  8755. this.insertSymbol(declaration.id, { id: declaration.id, type: declaration.type });
  8756. }
  8757. }
  8758. }
  8759. }, {
  8760. key: 'evaluateExpressionType',
  8761. value: function evaluateExpressionType(expression) {
  8762. if (expression instanceof _expressions.UnaryApp) {
  8763. var op = expression.op;
  8764. var resultType = this.evaluateExpressionType(expression.left);
  8765. return (0, _compatibilityTable.resultTypeAfterUnaryOp)(op, resultType);
  8766. } else if (expression instanceof _expressions.InfixApp) {
  8767. var _op = expression.op;
  8768. var resultTypeLeft = this.evaluateExpressionType(expression.left);
  8769. var resultTypeRight = this.evaluateExpressionType(expression.right);
  8770. return (0, _compatibilityTable.resultTypeAfterInfixOp)(_op, resultTypeLeft, resultTypeRight);
  8771. } else if (expression instanceof _literal.Literal) {
  8772. return this.evaluateLiteralType(expression);
  8773. } else if (expression instanceof _expressions.FunctionCall) {
  8774. if (expression.isMainCall) {
  8775. throw _processorErrorFactory.ProcessorErrorFactory.void_in_expression_full(_definedFunctions.LanguageDefinedFunction.getMainFunctionName(), expression.sourceInfo);
  8776. }
  8777. var fun = this.findFunction(expression.id);
  8778. if (fun === null) {
  8779. throw _processorErrorFactory.ProcessorErrorFactory.function_missing_full(expression.id, expression.sourceInfo);
  8780. }
  8781. if (fun.returnType.isCompatible(_types.Types.VOID)) {
  8782. throw _processorErrorFactory.ProcessorErrorFactory.void_in_expression_full(expression.id, expression.sourceInfo);
  8783. }
  8784. this.assertParameters(fun, expression.actualParameters);
  8785. return fun.returnType;
  8786. } else if (expression instanceof _expressions.ArrayAccess) {
  8787. var arrayTypeInfo = this.findSymbol(expression.id, this.symbolMap);
  8788. if (arrayTypeInfo === null) {
  8789. throw _processorErrorFactory.ProcessorErrorFactory.symbol_not_found_full(expression.id, expression.sourceInfo);
  8790. }
  8791. if (!(arrayTypeInfo.type instanceof _compoundType.CompoundType)) {
  8792. throw _processorErrorFactory.ProcessorErrorFactory.invalid_array_access_full(expression.id, expression.sourceInfo);
  8793. }
  8794. var lineType = this.evaluateExpressionType(expression.line);
  8795. if (!lineType.isCompatible(_types.Types.INTEGER)) {
  8796. throw _processorErrorFactory.ProcessorErrorFactory.array_dimension_not_int_full(expression.sourceInfo);
  8797. }
  8798. if (expression.column !== null) {
  8799. if (arrayTypeInfo.columns === null) {
  8800. throw _processorErrorFactory.ProcessorErrorFactory.invalid_matrix_access_full(expression.id, expression.sourceInfo);
  8801. }
  8802. var columnType = this.evaluateExpressionType(expression.column);
  8803. if (!columnType.isCompatible(_types.Types.INTEGER)) {
  8804. throw _processorErrorFactory.ProcessorErrorFactory.array_dimension_not_int_full(expression.sourceInfo);
  8805. }
  8806. }
  8807. var arrType = arrayTypeInfo.type;
  8808. if (expression.column !== null) {
  8809. // indexing matrix
  8810. return arrType.innerType;
  8811. } else {
  8812. if (arrayTypeInfo.columns === null) {
  8813. return arrType.innerType;
  8814. }
  8815. return new _compoundType.CompoundType(arrType.innerType, 1);
  8816. }
  8817. }
  8818. }
  8819. }, {
  8820. key: 'evaluateLiteralType',
  8821. value: function evaluateLiteralType(literal) {
  8822. if (literal instanceof _expressions.IntLiteral) {
  8823. return literal.type;
  8824. } else if (literal instanceof _expressions.RealLiteral) {
  8825. return literal.type;
  8826. } else if (literal instanceof _expressions.StringLiteral) {
  8827. return literal.type;
  8828. } else if (literal instanceof _expressions.BoolLiteral) {
  8829. return literal.type;
  8830. } else if (literal instanceof _expressions.VariableLiteral) {
  8831. var typeInfo = this.findSymbol(literal.id, this.symbolMap);
  8832. if (typeInfo === null) {
  8833. throw _processorErrorFactory.ProcessorErrorFactory.symbol_not_found_full(literal.id, literal.sourceInfo);
  8834. }
  8835. if (typeInfo.type instanceof _compoundType.CompoundType) {
  8836. return typeInfo.type;
  8837. }
  8838. return typeInfo.type;
  8839. } else {
  8840. console.warn("Evaluating type only for an array literal...");
  8841. var last = null;
  8842. if (literal.value.length === 1) {
  8843. last = this.evaluateExpressionType(literal.value[0]);
  8844. } else {
  8845. for (var i = 0; i < literal.value.length; i++) {
  8846. var e = this.evaluateExpressionType(literal.value[i]);
  8847. if (last === null) {
  8848. last = e;
  8849. } else if (!last.isCompatible(e)) {
  8850. var strInfo = last.stringInfo();
  8851. var info = strInfo[0];
  8852. var strExp = literal.toString();
  8853. throw _processorErrorFactory.ProcessorErrorFactory.incompatible_types_array_full(strExp, info.type, info.dim, literal.sourceInfo);
  8854. }
  8855. }
  8856. }
  8857. if (last instanceof _compoundType.CompoundType) {
  8858. return new _compoundType.CompoundType(last.innerType, last.dimensions + 1);
  8859. }
  8860. return new _compoundType.CompoundType(last, 1);
  8861. }
  8862. }
  8863. }, {
  8864. key: 'evaluateArrayLiteral',
  8865. value: function evaluateArrayLiteral(id, lines, columns, type, literal) {
  8866. /* if (literal instanceof ArrayLiteral) {
  8867. const dimType = this.evaluateExpressionType(lines);
  8868. if (!dimType.isCompatible(Types.INTEGER)) {
  8869. throw ProcessorErrorFactory.array_dimension_not_int_full(literal.sourceInfo);
  8870. }
  8871. if ((lines instanceof IntLiteral)) {
  8872. if (!lines.value.eq(literal.value.length)) {
  8873. if(type.dimensions > 1) {
  8874. throw ProcessorErrorFactory.matrix_line_outbounds_full(id, literal.value.length, lines.value.toNumber(), literal.sourceInfo)
  8875. } else {
  8876. throw ProcessorErrorFactory.vector_line_outbounds_full(id, literal.value.length, lines.value.toNumber(), literal.sourceInfo)
  8877. }
  8878. } else if (lines.value.isNeg()) {
  8879. throw ProcessorErrorFactory.array_dimension_not_positive_full(literal.sourceInfo);
  8880. }
  8881. }
  8882. if (columns === null) {
  8883. // it's a vector...
  8884. literal.value.reduce((last, next) => {
  8885. const eType = this.evaluateExpressionType(next);
  8886. if (!last.canAccept(eType)) {
  8887. const strInfo = last.stringInfo();
  8888. const info = strInfo[0];
  8889. const strExp = literal.toString();
  8890. throw ProcessorErrorFactory.incompatible_types_array_full(strExp,info.type, info.dim, literal.sourceInfo);
  8891. }
  8892. return last;
  8893. }, type);
  8894. return true;
  8895. } else {
  8896. const dimType = this.evaluateExpressionType(columns);
  8897. if (!dimType.isCompatible(Types.INTEGER)) {
  8898. throw ProcessorErrorFactory.array_dimension_not_int_full(literal.sourceInfo);
  8899. }
  8900. if ((columns instanceof IntLiteral)) {
  8901. const columnValue = literal.value[0].value.length;
  8902. if (!columns.value.eq(columnValue)) {
  8903. if(type.dimensions > 1) {
  8904. throw ProcessorErrorFactory.matrix_column_outbounds_full(id, literal.value.length, columns.value.toNumber(), literal.sourceInfo)
  8905. } else {
  8906. throw ProcessorErrorFactory.invalid_matrix_access_full(id, literal.sourceInfo);
  8907. }
  8908. } else if (columns.value.isNeg()) {
  8909. throw ProcessorErrorFactory.array_dimension_not_positive_full(literal.sourceInfo);
  8910. }
  8911. for (let i = 0; i < columns; i++) {
  8912. const anotherArray = literal.value[i];
  8913. this.evaluateArrayLiteral(id, columns, null, type, anotherArray)
  8914. }
  8915. }
  8916. }
  8917. } else {
  8918. const resultType = this.evaluateExpressionType(literal);
  8919. if (!(resultType instanceof CompoundType)) {
  8920. const strInfo = type.stringInfo();
  8921. const info = strInfo[0];
  8922. const strExp = literal.toString();
  8923. throw ProcessorErrorFactory.incompatible_types_array_full(strExp,info.type, info.dim, literal.sourceInfo);
  8924. }
  8925. if (!type.isCompatible(resultType)) {
  8926. const strInfo = type.stringInfo();
  8927. const info = strInfo[0];
  8928. const strExp = literal.toString();
  8929. throw ProcessorErrorFactory.incompatible_types_array_full(strExp,info.type, info.dim, literal.sourceInfo);
  8930. }
  8931. return true;
  8932. } */
  8933. return true;
  8934. }
  8935. }, {
  8936. key: 'assertFunction',
  8937. value: function assertFunction(fun) {
  8938. var _this = this;
  8939. this.pushMap();
  8940. this.currentFunction = fun;
  8941. fun.formalParameters.forEach(function (formalParam) {
  8942. if (formalParam.type instanceof _compoundType.CompoundType) {
  8943. if (formalParam.type.dimensions > 1) {
  8944. _this.insertSymbol(formalParam.id, { id: formalParam.id, lines: -1, columns: -1, type: formalParam.type });
  8945. } else {
  8946. _this.insertSymbol(formalParam.id, { id: formalParam.id, lines: -1, columns: null, type: formalParam.type });
  8947. }
  8948. } else {
  8949. _this.insertSymbol(formalParam.id, { id: formalParam.id, type: formalParam.type });
  8950. }
  8951. });
  8952. this.assertDeclarations(fun.variablesDeclarations);
  8953. var optional = fun.returnType.isCompatible(_types.Types.VOID);
  8954. var valid = this.assertReturn(fun, optional);
  8955. if (!valid) {
  8956. throw _processorErrorFactory.ProcessorErrorFactory.function_no_return(fun.name);
  8957. }
  8958. this.popMap();
  8959. }
  8960. }, {
  8961. key: 'assertReturn',
  8962. value: function assertReturn(fun, optional) {
  8963. var _this2 = this;
  8964. return fun.commands.reduce(function (last, next) {
  8965. return _this2.checkCommand(fun.returnType, next, optional) || last;
  8966. }, optional);
  8967. }
  8968. }, {
  8969. key: 'checkCommand',
  8970. value: function checkCommand(type, cmd, optional) {
  8971. if (cmd instanceof _commands.While) {
  8972. var resultType = this.evaluateExpressionType(cmd.expression);
  8973. if (!resultType.isCompatible(_types.Types.BOOLEAN)) {
  8974. throw _processorErrorFactory.ProcessorErrorFactory.loop_condition_type_full(cmd.sourceInfo);
  8975. }
  8976. this.checkCommands(type, cmd.commands, optional);
  8977. return false;
  8978. } else if (cmd instanceof _commands.For) {
  8979. this.checkCommand(type, cmd.assignment, optional);
  8980. var _resultType = this.evaluateExpressionType(cmd.condition);
  8981. if (!_resultType.isCompatible(_types.Types.BOOLEAN)) {
  8982. throw _processorErrorFactory.ProcessorErrorFactory.for_condition_type_full(cmd.sourceInfo);
  8983. }
  8984. this.checkCommand(type, cmd.increment, optional);
  8985. this.checkCommands(type, cmd.commands, optional);
  8986. return false;
  8987. } else if (cmd instanceof _commands.Switch) {
  8988. var sType = this.evaluateExpressionType(cmd.expression);
  8989. var result = optional;
  8990. var hasDefault = false;
  8991. for (var i = 0; i < cmd.cases.length; i++) {
  8992. var aCase = cmd.cases[i];
  8993. if (aCase.expression !== null) {
  8994. var caseType = this.evaluateExpressionType(aCase.expression);
  8995. if (!sType.isCompatible(caseType)) {
  8996. var strInfo = sType.stringInfo();
  8997. var info = strInfo[0];
  8998. var strExp = aCase.expression.toString();
  8999. throw _processorErrorFactory.ProcessorErrorFactory.invalid_case_type_full(strExp, info.type, info.dim, aCase.sourceInfo);
  9000. }
  9001. } else {
  9002. hasDefault = true;
  9003. }
  9004. result = result && this.checkCommands(type, aCase.commands, result);
  9005. }
  9006. return result && hasDefault;
  9007. } else if (cmd instanceof _commands.ArrayIndexAssign) {
  9008. var typeInfo = this.findSymbol(cmd.id, this.symbolMap);
  9009. if (typeInfo === null) {
  9010. throw _processorErrorFactory.ProcessorErrorFactory.symbol_not_found_full(cmd.id, cmd.sourceInfo);
  9011. }
  9012. if (!(typeInfo.type instanceof _compoundType.CompoundType)) {
  9013. throw _processorErrorFactory.ProcessorErrorFactory.invalid_array_access_full(cmd.id, cmd.sourceInfo);
  9014. }
  9015. var exp = cmd.expression;
  9016. var lineExp = cmd.line;
  9017. var lineType = this.evaluateExpressionType(lineExp);
  9018. if (!lineType.isCompatible(_types.Types.INTEGER)) {
  9019. throw _processorErrorFactory.ProcessorErrorFactory.array_dimension_not_int_full(cmd.sourceInfo);
  9020. }
  9021. var columnExp = cmd.column;
  9022. if (typeInfo.columns === null && columnExp !== null) {
  9023. throw _processorErrorFactory.ProcessorErrorFactory.invalid_matrix_access_full(cmd.id, cmd.sourceInfo);
  9024. } else if (columnExp !== null) {
  9025. var columnType = this.evaluateExpressionType(columnExp);
  9026. if (!columnType.isCompatible(_types.Types.INTEGER)) {
  9027. throw _processorErrorFactory.ProcessorErrorFactory.array_dimension_not_int_full(cmd.sourceInfo);
  9028. }
  9029. }
  9030. // exp can be a arrayLiteral, a single value exp or an array access
  9031. if (exp instanceof _expressions.ArrayLiteral) {
  9032. this.evaluateArrayLiteral(cmd.id, typeInfo.lines, columnExp ? typeInfo.columns : null, typeInfo.type, exp);
  9033. } else {
  9034. // cannot properly evaluate since type system is poorly constructed
  9035. }
  9036. return optional;
  9037. } else if (cmd instanceof _commands.Assign) {
  9038. var _typeInfo = this.findSymbol(cmd.id, this.symbolMap);
  9039. if (_typeInfo === null) {
  9040. throw _processorErrorFactory.ProcessorErrorFactory.symbol_not_found_full(cmd.id, cmd.sourceInfo);
  9041. }
  9042. var _exp = cmd.expression;
  9043. if (_exp instanceof _expressions.ArrayLiteral) {
  9044. if (!(_typeInfo.type instanceof _compoundType.CompoundType)) {
  9045. var stringInfo = _typeInfo.type.stringInfo();
  9046. var _info2 = stringInfo[0];
  9047. throw _processorErrorFactory.ProcessorErrorFactory.incompatible_types_full(_info2.type, _info2.dim, cmd.sourceInfo);
  9048. }
  9049. this.evaluateArrayLiteral(cmd.id, _typeInfo.lines, _typeInfo.columns, _typeInfo.type, _exp);
  9050. } else {
  9051. var _resultType2 = this.evaluateExpressionType(_exp);
  9052. if (!_resultType2.isCompatible(_typeInfo.type) && !_config.Config.enable_type_casting || !_resultType2.isCompatible(_typeInfo.type) && _config.Config.enable_type_casting && !_store.Store.canImplicitTypeCast(_typeInfo.type, _resultType2)) {
  9053. var _stringInfo2 = _typeInfo.type.stringInfo();
  9054. var _info3 = _stringInfo2[0];
  9055. throw _processorErrorFactory.ProcessorErrorFactory.incompatible_types_full(_info3.type, _info3.dim, cmd.sourceInfo);
  9056. }
  9057. }
  9058. return optional;
  9059. } else if (cmd instanceof _commands.Break) {
  9060. return optional;
  9061. } else if (cmd instanceof _commands.IfThenElse) {
  9062. var _resultType3 = this.evaluateExpressionType(cmd.condition);
  9063. if (!_resultType3.isCompatible(_types.Types.BOOLEAN)) {
  9064. throw _processorErrorFactory.ProcessorErrorFactory.if_condition_type_full(cmd.sourceInfo);
  9065. }
  9066. if (cmd.ifFalse instanceof _commands.IfThenElse) {
  9067. return this.checkCommands(type, cmd.ifTrue.commands, optional) && this.checkCommand(type, cmd.ifFalse, optional);
  9068. } else {
  9069. return this.checkCommands(type, cmd.ifTrue.commands, optional) && this.checkCommands(type, cmd.ifFalse.commands, optional);
  9070. }
  9071. } else if (cmd instanceof _expressions.FunctionCall) {
  9072. var fun = null;
  9073. if (cmd.isMainCall) {
  9074. fun = this.getMainFunction();
  9075. } else {
  9076. fun = this.findFunction(cmd.id);
  9077. }
  9078. if (fun === null) {
  9079. throw _processorErrorFactory.ProcessorErrorFactory.function_missing_full(cmd.id, cmd.sourceInfo);
  9080. }
  9081. this.assertParameters(fun, cmd.actualParameters);
  9082. return optional;
  9083. } else if (cmd instanceof _commands.Return) {
  9084. var funcName = this.currentFunction.isMain ? _definedFunctions.LanguageDefinedFunction.getMainFunctionName() : this.currentFunction.name;
  9085. if (cmd.expression === null && !type.isCompatible(_types.Types.VOID)) {
  9086. var _stringInfo3 = type.stringInfo();
  9087. var _info4 = _stringInfo3[0];
  9088. throw _processorErrorFactory.ProcessorErrorFactory.invalid_void_return_full(funcName, _info4.type, _info4.dim, cmd.sourceInfo);
  9089. } else if (cmd.expression !== null) {
  9090. var _resultType4 = this.evaluateExpressionType(cmd.expression);
  9091. if (!type.isCompatible(_resultType4)) {
  9092. var _stringInfo4 = type.stringInfo();
  9093. var _info5 = _stringInfo4[0];
  9094. throw _processorErrorFactory.ProcessorErrorFactory.invalid_return_type_full(funcName, _info5.type, _info5.dim, cmd.sourceInfo);
  9095. } else {
  9096. return true;
  9097. }
  9098. } else {
  9099. return true;
  9100. }
  9101. }
  9102. }
  9103. }, {
  9104. key: 'checkCommands',
  9105. value: function checkCommands(type, cmds, optional) {
  9106. var _this3 = this;
  9107. return cmds.reduce(function (last, next) {
  9108. return _this3.checkCommand(type, next, optional) || last;
  9109. }, optional);
  9110. }
  9111. }, {
  9112. key: 'assertParameters',
  9113. value: function assertParameters(fun, actualParametersList) {
  9114. if (fun.formalParameters.length !== actualParametersList.length) {
  9115. throw _processorErrorFactory.ProcessorErrorFactory.invalid_parameters_size_full(fun.name, actualParametersList.length, fun.formalParameters.length, null);
  9116. }
  9117. for (var i = 0; i < actualParametersList.length; i++) {
  9118. var param = actualParametersList[i];
  9119. var formalParam = fun.formalParameters[i];
  9120. var id = formalParam.id;
  9121. if (formalParam.byRef) {
  9122. if (!(param instanceof _expressions.VariableLiteral || param instanceof _expressions.ArrayAccess)) {
  9123. throw _processorErrorFactory.ProcessorErrorFactory.invalid_parameter_type_full(id, param.toString(), param.sourceInfo);
  9124. }
  9125. }
  9126. var resultType = this.evaluateExpressionType(param);
  9127. if (resultType instanceof _multiType.MultiType && formalParam.type instanceof _multiType.MultiType) {
  9128. var shared = 0;
  9129. for (var j = 0; j < resultType.types.length; j++) {
  9130. var element = resultType.types[j];
  9131. if (formalParam.type.types.indexOf(element) !== -1) {
  9132. shared++;
  9133. }
  9134. }
  9135. if (shared <= 0) {
  9136. if (_config.Config.enable_type_casting && !formalParam.byRef) {
  9137. if (resultType.isCompatible(_types.Types.INTEGER) || resultType.isCompatible(_types.Types.REAL)) {
  9138. if (formalParam.type.isCompatible(_types.Types.INTEGER) || formalParam.type.isCompatible(_types.Types.REAL)) {
  9139. continue;
  9140. }
  9141. }
  9142. }
  9143. throw _processorErrorFactory.ProcessorErrorFactory.invalid_parameter_type_full(id, param.toString(), param.sourceInfo);
  9144. }
  9145. } else if (resultType instanceof _multiType.MultiType) {
  9146. if (!resultType.isCompatible(formalParam.type)) {
  9147. if (_config.Config.enable_type_casting && !formalParam.byRef) {
  9148. if (resultType.isCompatible(_types.Types.INTEGER) || resultType.isCompatible(_types.Types.REAL)) {
  9149. if (formalParam.type.isCompatible(_types.Types.INTEGER) || formalParam.type.isCompatible(_types.Types.REAL)) {
  9150. continue;
  9151. }
  9152. }
  9153. }
  9154. throw _processorErrorFactory.ProcessorErrorFactory.invalid_parameter_type_full(id, param.toString(), param.sourceInfo);
  9155. }
  9156. } else if (!formalParam.type.isCompatible(resultType)) {
  9157. if (_config.Config.enable_type_casting && !formalParam.byRef) {
  9158. if (_store.Store.canImplicitTypeCast(formalParam.type, resultType)) {
  9159. continue;
  9160. }
  9161. }
  9162. throw _processorErrorFactory.ProcessorErrorFactory.invalid_parameter_type_full(id, param.toString(), param.sourceInfo);
  9163. }
  9164. }
  9165. }
  9166. }]);
  9167. return SemanticAnalyser;
  9168. }();
  9169. /***/ }),
  9170. /***/ "./js/processor/store/store.js":
  9171. /*!*************************************!*\
  9172. !*** ./js/processor/store/store.js ***!
  9173. \*************************************/
  9174. /*! no static exports found */
  9175. /***/ (function(module, exports, __webpack_require__) {
  9176. "use strict";
  9177. Object.defineProperty(exports, "__esModule", {
  9178. value: true
  9179. });
  9180. exports.Store = undefined;
  9181. 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; }; }();
  9182. var _modes = __webpack_require__(/*! ./../modes */ "./js/processor/modes.js");
  9183. var _types = __webpack_require__(/*! ./../../typeSystem/types */ "./js/typeSystem/types.js");
  9184. var _storeObject = __webpack_require__(/*! ./storeObject */ "./js/processor/store/storeObject.js");
  9185. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  9186. var Store = exports.Store = function () {
  9187. _createClass(Store, null, [{
  9188. key: 'canImplicitTypeCast',
  9189. value: function canImplicitTypeCast(castType, sourceType) {
  9190. if (castType.isCompatible(_types.Types.INTEGER) || castType.isCompatible(_types.Types.REAL)) {
  9191. if (sourceType.isCompatible(_types.Types.INTEGER) || sourceType.isCompatible(_types.Types.REAL)) {
  9192. return true;
  9193. }
  9194. }
  9195. return false;
  9196. }
  9197. }, {
  9198. key: 'doImplicitCasting',
  9199. value: function doImplicitCasting(castType, stoObj) {
  9200. if (!Store.canImplicitTypeCast(castType, stoObj.type)) {
  9201. throw new Error("!!!Critical error: attempted to type cast invalid types");
  9202. }
  9203. if (_types.Types.INTEGER.isCompatible(castType)) {
  9204. return new _storeObject.StoreObject(castType, stoObj.value.trunc());
  9205. } else {
  9206. return new _storeObject.StoreObject(castType, stoObj.value);
  9207. }
  9208. }
  9209. }]);
  9210. function Store(name) {
  9211. _classCallCheck(this, Store);
  9212. this.name = name;
  9213. this.store = {};
  9214. this.nextStore = null;
  9215. this.mode = _modes.Modes.RUN;
  9216. }
  9217. _createClass(Store, [{
  9218. key: 'extendStore',
  9219. value: function extendStore(nextStore) {
  9220. this.nextStore = nextStore;
  9221. }
  9222. }, {
  9223. key: 'applyStore',
  9224. value: function applyStore(id) {
  9225. if (!this.store[id]) {
  9226. if (this.nextStore !== null) {
  9227. return this.nextStore.applyStore(id);
  9228. } else {
  9229. throw new Error('Variable ' + id + ' not found.');
  9230. }
  9231. }
  9232. var val = this.store[id];
  9233. if (val.isRef) {
  9234. return val.getRefObj();
  9235. }
  9236. return this.store[id];
  9237. }
  9238. }, {
  9239. key: 'updateStore',
  9240. value: function updateStore(id, stoObj) {
  9241. if (!this.store[id]) {
  9242. if (this.nextStore !== null) {
  9243. this.nextStore.updateStore(id, stoObj);
  9244. return this;
  9245. } else {
  9246. // TODO: better error message
  9247. throw new Error('Variable ' + id + ' not found.');
  9248. }
  9249. } else {
  9250. var oldObj = this.store[id];
  9251. if (oldObj.readOnly) {
  9252. // TODO: better error message
  9253. throw new Error("Cannot change value of a read only variable: " + id);
  9254. }
  9255. if (oldObj.isRef) {
  9256. oldObj.updateRef(stoObj);
  9257. return this;
  9258. } else if (oldObj.isCompatible(stoObj)) {
  9259. stoObj.setID(id);
  9260. this.store[id] = Object.freeze(stoObj);
  9261. return this;
  9262. } else {
  9263. var oldType = oldObj.type;
  9264. var stoType = stoObj.type;
  9265. // TODO: better error message
  9266. throw new Error(oldType + ' is not compatible with type ' + stoType + ' given');
  9267. }
  9268. }
  9269. }
  9270. //In case of future use of ref, it needs to have a special function to update the storeRefObject
  9271. // and no the StoreObject refferenced by it
  9272. // updateStoreRef(id, stoObjAddress) {...}
  9273. }, {
  9274. key: 'insertStore',
  9275. value: function insertStore(id, stoObj) {
  9276. if (this.store[id]) {
  9277. // TODO: better error message
  9278. throw new Error(id + ' is already defined');
  9279. }
  9280. stoObj.setID(id);
  9281. this.store[id] = Object.freeze(stoObj);
  9282. return this;
  9283. }
  9284. }]);
  9285. return Store;
  9286. }();
  9287. /***/ }),
  9288. /***/ "./js/processor/store/storeObject.js":
  9289. /*!*******************************************!*\
  9290. !*** ./js/processor/store/storeObject.js ***!
  9291. \*******************************************/
  9292. /*! no static exports found */
  9293. /***/ (function(module, exports, __webpack_require__) {
  9294. "use strict";
  9295. Object.defineProperty(exports, "__esModule", {
  9296. value: true
  9297. });
  9298. exports.StoreObject = undefined;
  9299. 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; }; }();
  9300. var _decimal = __webpack_require__(/*! decimal.js */ "./node_modules/decimal.js/decimal.js");
  9301. var _decimal2 = _interopRequireDefault(_decimal);
  9302. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  9303. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  9304. var StoreObject = exports.StoreObject = function () {
  9305. function StoreObject(type, value) {
  9306. var readOnly = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  9307. _classCallCheck(this, StoreObject);
  9308. this._type = type;
  9309. this._value = value;
  9310. this._readOnly = readOnly;
  9311. this._id = null;
  9312. }
  9313. _createClass(StoreObject, [{
  9314. key: 'setID',
  9315. value: function setID(id) {
  9316. this._id = id;
  9317. }
  9318. }, {
  9319. key: 'isCompatible',
  9320. value: function isCompatible(another) {
  9321. if (another instanceof StoreObject) {
  9322. return this.type.isCompatible(another.type);
  9323. }
  9324. return false;
  9325. }
  9326. }, {
  9327. key: 'id',
  9328. get: function get() {
  9329. return this._id;
  9330. }
  9331. }, {
  9332. key: 'inStore',
  9333. get: function get() {
  9334. return this.id !== null;
  9335. }
  9336. }, {
  9337. key: 'type',
  9338. get: function get() {
  9339. return this._type;
  9340. }
  9341. }, {
  9342. key: 'value',
  9343. get: function get() {
  9344. return this._value;
  9345. }
  9346. }, {
  9347. key: 'number',
  9348. get: function get() {
  9349. if (this._value instanceof _decimal2.default) {
  9350. return this._value.toNumber();
  9351. } else {
  9352. return null;
  9353. }
  9354. }
  9355. }, {
  9356. key: 'readOnly',
  9357. get: function get() {
  9358. return this._readOnly;
  9359. },
  9360. set: function set(value) {
  9361. this._readOnly = value;
  9362. }
  9363. }]);
  9364. return StoreObject;
  9365. }();
  9366. /***/ }),
  9367. /***/ "./js/processor/store/storeObjectArray.js":
  9368. /*!************************************************!*\
  9369. !*** ./js/processor/store/storeObjectArray.js ***!
  9370. \************************************************/
  9371. /*! no static exports found */
  9372. /***/ (function(module, exports, __webpack_require__) {
  9373. "use strict";
  9374. Object.defineProperty(exports, "__esModule", {
  9375. value: true
  9376. });
  9377. exports.StoreObjectArray = undefined;
  9378. 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); } };
  9379. 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; }; }();
  9380. var _storeObject = __webpack_require__(/*! ./storeObject */ "./js/processor/store/storeObject.js");
  9381. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  9382. 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; }
  9383. 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; }
  9384. var StoreObjectArray = exports.StoreObjectArray = function (_StoreObject) {
  9385. _inherits(StoreObjectArray, _StoreObject);
  9386. _createClass(StoreObjectArray, null, [{
  9387. key: 'WRONG_LINE_NUMBER',
  9388. get: function get() {
  9389. return 1;
  9390. }
  9391. }, {
  9392. key: 'WRONG_TYPE',
  9393. get: function get() {
  9394. return 2;
  9395. }
  9396. }, {
  9397. key: 'WRONG_COLUMN_NUMBER',
  9398. get: function get() {
  9399. return 3;
  9400. }
  9401. }]);
  9402. function StoreObjectArray(type, lines, columns) {
  9403. var value = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
  9404. var readOnly = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
  9405. _classCallCheck(this, StoreObjectArray);
  9406. var _this = _possibleConstructorReturn(this, (StoreObjectArray.__proto__ || Object.getPrototypeOf(StoreObjectArray)).call(this, type, value, readOnly));
  9407. _this._lines = lines;
  9408. _this._columns = columns;
  9409. return _this;
  9410. }
  9411. _createClass(StoreObjectArray, [{
  9412. key: 'isCompatible',
  9413. value: function isCompatible(another) {
  9414. if (another instanceof _storeObject.StoreObject) {
  9415. if (this.lines === -1 && another.lines > 0 || this.lines === another.lines) {
  9416. if (this.columns === -1 && another.columns > 0 || this.columns === another.columns) {
  9417. return _get(StoreObjectArray.prototype.__proto__ || Object.getPrototypeOf(StoreObjectArray.prototype), 'isCompatible', this).call(this, another);
  9418. }
  9419. }
  9420. }
  9421. return false;
  9422. }
  9423. }, {
  9424. key: 'lines',
  9425. get: function get() {
  9426. return this._lines;
  9427. }
  9428. }, {
  9429. key: 'columns',
  9430. get: function get() {
  9431. return this._columns;
  9432. }
  9433. }, {
  9434. key: 'isVector',
  9435. get: function get() {
  9436. return this.type.dimensions === 1;
  9437. }
  9438. }, {
  9439. key: 'isValid',
  9440. get: function get() {
  9441. var _this2 = this;
  9442. if (this.value !== null) {
  9443. if (this.isVector) {
  9444. if (this.value.length !== this.lines) {
  9445. return [StoreObjectArray.WRONG_LINE_NUMBER, this.value.length];;
  9446. }
  9447. var mustBeNull = this.value.find(function (v) {
  9448. return !_this2.type.canAccept(v.type);
  9449. });
  9450. if (!!mustBeNull) {
  9451. return [StoreObjectArray.WRONG_TYPE, this.value.indexOf(mustBeNull)];;
  9452. }
  9453. }
  9454. return [];
  9455. } else {
  9456. if (this.lines !== this.value.length) {
  9457. return [StoreObjectArray.WRONG_LINE_NUMBER, this.value.length];
  9458. }
  9459. for (var i = 0; i < this.lines; i++) {
  9460. for (var j = 0; j < this.columns; j++) {
  9461. var arr = this.value[i];
  9462. if (arr.length !== this.columns) {
  9463. return [StoreObjectArray.WRONG_COLUMN_NUMBER, arr.length];
  9464. }
  9465. var _mustBeNull = arr.find(function (v) {
  9466. return !_this2.type.canAccept(v.type);
  9467. });
  9468. if (!!_mustBeNull) {
  9469. return [StoreObjectArray.WRONG_TYPE, i, arr.indexOf(_mustBeNull)];
  9470. }
  9471. }
  9472. }
  9473. return [];
  9474. }
  9475. }
  9476. }]);
  9477. return StoreObjectArray;
  9478. }(_storeObject.StoreObject);
  9479. /***/ }),
  9480. /***/ "./js/processor/store/storeObjectArrayAddress.js":
  9481. /*!*******************************************************!*\
  9482. !*** ./js/processor/store/storeObjectArrayAddress.js ***!
  9483. \*******************************************************/
  9484. /*! no static exports found */
  9485. /***/ (function(module, exports, __webpack_require__) {
  9486. "use strict";
  9487. Object.defineProperty(exports, "__esModule", {
  9488. value: true
  9489. });
  9490. exports.StoreObjectArrayAddress = undefined;
  9491. 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; }; }();
  9492. var _storeObject = __webpack_require__(/*! ./storeObject */ "./js/processor/store/storeObject.js");
  9493. var _storeObjectArray = __webpack_require__(/*! ./storeObjectArray */ "./js/processor/store/storeObjectArray.js");
  9494. var _compoundType = __webpack_require__(/*! ../../typeSystem/compoundType */ "./js/typeSystem/compoundType.js");
  9495. var _processorErrorFactory = __webpack_require__(/*! ../error/processorErrorFactory */ "./js/processor/error/processorErrorFactory.js");
  9496. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  9497. 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; }
  9498. 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; }
  9499. var StoreObjectArrayAddress = exports.StoreObjectArrayAddress = function (_StoreObject) {
  9500. _inherits(StoreObjectArrayAddress, _StoreObject);
  9501. function StoreObjectArrayAddress(refID, line, column, store) {
  9502. _classCallCheck(this, StoreObjectArrayAddress);
  9503. var _this = _possibleConstructorReturn(this, (StoreObjectArrayAddress.__proto__ || Object.getPrototypeOf(StoreObjectArrayAddress)).call(this, null, null, false));
  9504. _this.refID = refID;
  9505. _this.store = store;
  9506. _this.line = line;
  9507. _this.column = column;
  9508. return _this;
  9509. }
  9510. _createClass(StoreObjectArrayAddress, [{
  9511. key: 'getArrayObject',
  9512. value: function getArrayObject() {
  9513. return this.store.applyStore(this.refID);
  9514. }
  9515. }, {
  9516. key: 'updateArrayObject',
  9517. value: function updateArrayObject(stoObj) {
  9518. var anArray = this.getArrayObject();
  9519. var newArray = Object.assign(new _storeObjectArray.StoreObjectArray(null, null, null), anArray);
  9520. if (!stoObj.type.isCompatible(this.type)) {
  9521. throw new Error('Invalid operation: cannot assign the value given to ' + this.refID);
  9522. } else if (this.type instanceof _compoundType.CompoundType && this.type.canAccept(stoObj.type)) {
  9523. throw new Error('Invalid operation: cannot assign the value given to ' + this.refID);
  9524. }
  9525. if (this.column !== null) {
  9526. newArray.value[this.line].value[this.column] = stoObj;
  9527. return newArray;
  9528. } else {
  9529. newArray.value[this.line] = stoObj;
  9530. return newArray;
  9531. }
  9532. }
  9533. }, {
  9534. key: 'isCompatible',
  9535. value: function isCompatible(another) {
  9536. if (this.type.isCompatible(another.type)) {
  9537. if (another.type instanceof _compoundType.CompoundType) {
  9538. return this.lines === another.lines && this.columns === another.columns;
  9539. } else {
  9540. this.refValue.isCompatible(another);
  9541. }
  9542. }
  9543. }
  9544. }, {
  9545. key: 'isRef',
  9546. get: function get() {
  9547. return false;
  9548. }
  9549. }, {
  9550. key: 'inStore',
  9551. get: function get() {
  9552. return true;
  9553. }
  9554. }, {
  9555. key: 'refValue',
  9556. get: function get() {
  9557. var refLine = this.store.applyStore(this.refID).value[this.line];
  9558. if (!refLine) {
  9559. if (this.getArrayObject().isVector) {
  9560. throw _processorErrorFactory.ProcessorErrorFactory.vector_line_outbounds(this.refID, this.line, this.getArrayObject().lines);
  9561. } else {
  9562. throw _processorErrorFactory.ProcessorErrorFactory.matrix_line_outbounds(this.refID, this.line, this.getArrayObject().lines);
  9563. }
  9564. }
  9565. if (this.column !== null) {
  9566. var refColumn = refLine.value[this.column];
  9567. if (!refColumn) {
  9568. if (this.getArrayObject().isVector) {
  9569. throw _processorErrorFactory.ProcessorErrorFactory.vector_not_matrix(this.refID);
  9570. } else {
  9571. throw _processorErrorFactory.ProcessorErrorFactory.matrix_column_outbounds(this.refID, this.column, this.getArrayObject().columns);
  9572. }
  9573. }
  9574. return refColumn;
  9575. }
  9576. return refLine;
  9577. }
  9578. }, {
  9579. key: 'value',
  9580. get: function get() {
  9581. return this.refValue.value;
  9582. }
  9583. }, {
  9584. key: 'type',
  9585. get: function get() {
  9586. return this.refValue.type;
  9587. }
  9588. }, {
  9589. key: 'lines',
  9590. get: function get() {
  9591. if (!(this.type instanceof _compoundType.CompoundType)) {
  9592. return null;
  9593. }
  9594. return this.refValue.value.length;
  9595. }
  9596. }, {
  9597. key: 'columns',
  9598. get: function get() {
  9599. switch (this.type.dimensions) {
  9600. case 2:
  9601. return this.refValue.value[0].value.length;
  9602. default:
  9603. return null;
  9604. }
  9605. }
  9606. }]);
  9607. return StoreObjectArrayAddress;
  9608. }(_storeObject.StoreObject);
  9609. /***/ }),
  9610. /***/ "./js/processor/store/storeObjectArrayAddressRef.js":
  9611. /*!**********************************************************!*\
  9612. !*** ./js/processor/store/storeObjectArrayAddressRef.js ***!
  9613. \**********************************************************/
  9614. /*! no static exports found */
  9615. /***/ (function(module, exports, __webpack_require__) {
  9616. "use strict";
  9617. Object.defineProperty(exports, "__esModule", {
  9618. value: true
  9619. });
  9620. exports.StoreObjectArrayAddressRef = undefined;
  9621. 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; }; }();
  9622. var _storeObject = __webpack_require__(/*! ./storeObject */ "./js/processor/store/storeObject.js");
  9623. var _decimal = __webpack_require__(/*! decimal.js */ "./node_modules/decimal.js/decimal.js");
  9624. var _decimal2 = _interopRequireDefault(_decimal);
  9625. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  9626. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  9627. 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; }
  9628. 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; }
  9629. var StoreObjectArrayAddressRef = exports.StoreObjectArrayAddressRef = function (_StoreObject) {
  9630. _inherits(StoreObjectArrayAddressRef, _StoreObject);
  9631. function StoreObjectArrayAddressRef(address) {
  9632. _classCallCheck(this, StoreObjectArrayAddressRef);
  9633. var _this = _possibleConstructorReturn(this, (StoreObjectArrayAddressRef.__proto__ || Object.getPrototypeOf(StoreObjectArrayAddressRef)).call(this, null, null, false));
  9634. _this.address = address;
  9635. return _this;
  9636. }
  9637. _createClass(StoreObjectArrayAddressRef, [{
  9638. key: 'getRefObj',
  9639. value: function getRefObj() {
  9640. return this.address.refValue;
  9641. }
  9642. }, {
  9643. key: 'updateRef',
  9644. value: function updateRef(stoObj) {
  9645. var newArray = this.address.updateArrayObject(stoObj);
  9646. this.address.store.updateStore(this.address.refID, newArray);
  9647. }
  9648. }, {
  9649. key: 'isCompatible',
  9650. value: function isCompatible(another) {
  9651. return this.address.isCompatible(another);
  9652. }
  9653. }, {
  9654. key: 'isRef',
  9655. get: function get() {
  9656. return true;
  9657. }
  9658. }, {
  9659. key: 'type',
  9660. get: function get() {
  9661. return this.address.type;
  9662. }
  9663. }, {
  9664. key: 'value',
  9665. get: function get() {
  9666. return this.address.value;
  9667. }
  9668. }, {
  9669. key: 'number',
  9670. get: function get() {
  9671. if (this.value instanceof _decimal2.default) {
  9672. return this.value.toNumber();
  9673. } else {
  9674. return null;
  9675. }
  9676. }
  9677. }]);
  9678. return StoreObjectArrayAddressRef;
  9679. }(_storeObject.StoreObject);
  9680. /***/ }),
  9681. /***/ "./js/processor/store/storeObjectRef.js":
  9682. /*!**********************************************!*\
  9683. !*** ./js/processor/store/storeObjectRef.js ***!
  9684. \**********************************************/
  9685. /*! no static exports found */
  9686. /***/ (function(module, exports, __webpack_require__) {
  9687. "use strict";
  9688. Object.defineProperty(exports, "__esModule", {
  9689. value: true
  9690. });
  9691. exports.StoreObjectRef = undefined;
  9692. 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; }; }();
  9693. var _storeObject = __webpack_require__(/*! ./storeObject */ "./js/processor/store/storeObject.js");
  9694. var _decimal = __webpack_require__(/*! decimal.js */ "./node_modules/decimal.js/decimal.js");
  9695. var _decimal2 = _interopRequireDefault(_decimal);
  9696. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  9697. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  9698. 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; }
  9699. 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; }
  9700. var StoreObjectRef = exports.StoreObjectRef = function (_StoreObject) {
  9701. _inherits(StoreObjectRef, _StoreObject);
  9702. function StoreObjectRef(refID, store) {
  9703. _classCallCheck(this, StoreObjectRef);
  9704. var _this = _possibleConstructorReturn(this, (StoreObjectRef.__proto__ || Object.getPrototypeOf(StoreObjectRef)).call(this, null, null, false));
  9705. _this.refID = refID;
  9706. _this.store = store;
  9707. return _this;
  9708. }
  9709. _createClass(StoreObjectRef, [{
  9710. key: 'getRefObj',
  9711. value: function getRefObj() {
  9712. return this.store.applyStore(this.refID);
  9713. }
  9714. }, {
  9715. key: 'updateRef',
  9716. value: function updateRef(stoObj) {
  9717. this.store.updateStore(this.refID, stoObj);
  9718. }
  9719. }, {
  9720. key: 'isCompatible',
  9721. value: function isCompatible(another) {
  9722. return this.store.applyStore(this.refID).isCompatible(another);
  9723. }
  9724. }, {
  9725. key: 'isRef',
  9726. get: function get() {
  9727. return true;
  9728. }
  9729. }, {
  9730. key: 'type',
  9731. get: function get() {
  9732. return this.store.applyStore(this.refID).type;
  9733. }
  9734. }, {
  9735. key: 'value',
  9736. get: function get() {
  9737. return this.store.applyStore(this.refID).value;
  9738. }
  9739. }, {
  9740. key: 'number',
  9741. get: function get() {
  9742. if (this.value instanceof _decimal2.default) {
  9743. return this.value.toNumber();
  9744. } else {
  9745. return null;
  9746. }
  9747. }
  9748. }]);
  9749. return StoreObjectRef;
  9750. }(_storeObject.StoreObject);
  9751. /***/ }),
  9752. /***/ "./js/runner.js":
  9753. /*!**********************!*\
  9754. !*** ./js/runner.js ***!
  9755. \**********************/
  9756. /*! no static exports found */
  9757. /***/ (function(module, exports, __webpack_require__) {
  9758. "use strict";
  9759. Object.defineProperty(exports, "__esModule", {
  9760. value: true
  9761. });
  9762. exports.runner = runner;
  9763. var _ivprogParser = __webpack_require__(/*! ./ast/ivprogParser */ "./js/ast/ivprogParser.js");
  9764. var _ivprogProcessor = __webpack_require__(/*! ./processor/ivprogProcessor */ "./js/processor/ivprogProcessor.js");
  9765. var _domConsole = __webpack_require__(/*! ./io/domConsole */ "./js/io/domConsole.js");
  9766. var _languageService = __webpack_require__(/*! ./services/languageService */ "./js/services/languageService.js");
  9767. var _semanticAnalyser = __webpack_require__(/*! ./processor/semantic/semanticAnalyser */ "./js/processor/semantic/semanticAnalyser.js");
  9768. function runner() {
  9769. var ivprogLexer = _languageService.LanguageService.getCurrentLexer();
  9770. // const lexer = new ivprogLexer(new InputStream(input));
  9771. // const stream = new CommonTokenStream(lexer);
  9772. // stream.fill();
  9773. // let i = 1;
  9774. // let token = null;
  9775. // while ((token = stream.LT(i)).type !== ivprogLexer.EOF && token.type !== ivprogLexer.WHITESPACE) {
  9776. // console.log(`${token.type}-${token.text}`);
  9777. // console.log('\n')
  9778. // i++;
  9779. // }
  9780. // const anaSin = new IVProgParser(input, ivprogLexer);
  9781. var editor = new JsonEditor('#json-renderer', {});
  9782. var domConsole = new _domConsole.DOMConsole("#console");
  9783. // proc.interpretAST().then( sto => {
  9784. // console.log(sto.applyStore('a'));
  9785. // }).catch(e => console.log(e));
  9786. try {
  9787. $('#btn').click(function () {
  9788. var input = $('#input').val();
  9789. var analiser = new _ivprogParser.IVProgParser(input, ivprogLexer);
  9790. try {
  9791. var data = analiser.parseTree();
  9792. var semAna = new _semanticAnalyser.SemanticAnalyser(data);
  9793. var proc = new _ivprogProcessor.IVProgProcessor(semAna.analyseTree());
  9794. proc.registerInput(domConsole);
  9795. domConsole.clear();
  9796. proc.registerOutput(domConsole);
  9797. proc.interpretAST().then(function (sto) {
  9798. return editor.load(sto.store);
  9799. }).catch(function (e) {
  9800. alert(e);console.log(e);
  9801. });
  9802. } catch (error) {
  9803. alert(error);
  9804. console.log(error);
  9805. }
  9806. });
  9807. } catch (a) {
  9808. console.log(a);
  9809. }
  9810. }
  9811. /***/ }),
  9812. /***/ "./js/semantic/semantic.min.js":
  9813. /*!*************************************!*\
  9814. !*** ./js/semantic/semantic.min.js ***!
  9815. \*************************************/
  9816. /*! no static exports found */
  9817. /***/ (function(module, exports, __webpack_require__) {
  9818. "use strict";
  9819. 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; };
  9820. /*
  9821. * # Semantic UI - 2.3.3
  9822. * https://github.com/Semantic-Org/Semantic-UI
  9823. * http://www.semantic-ui.com/
  9824. *
  9825. * Copyright 2014 Contributors
  9826. * Released under the MIT license
  9827. * http://opensource.org/licenses/MIT
  9828. *
  9829. */
  9830. !function (e, t, n, i) {
  9831. e.site = e.fn.site = function (o) {
  9832. var a,
  9833. r,
  9834. s = new Date().getTime(),
  9835. l = [],
  9836. c = arguments[0],
  9837. u = "string" == typeof c,
  9838. d = [].slice.call(arguments, 1),
  9839. f = e.isPlainObject(o) ? e.extend(!0, {}, e.site.settings, o) : e.extend({}, e.site.settings),
  9840. m = f.namespace,
  9841. g = f.error,
  9842. p = "module-" + m,
  9843. h = e(n),
  9844. v = this,
  9845. b = h.data(p);return a = { initialize: function initialize() {
  9846. a.instantiate();
  9847. }, instantiate: function instantiate() {
  9848. a.verbose("Storing instance of site", a), b = a, h.data(p, a);
  9849. }, normalize: function normalize() {
  9850. a.fix.console(), a.fix.requestAnimationFrame();
  9851. }, fix: { console: function (_console) {
  9852. function console() {
  9853. return _console.apply(this, arguments);
  9854. }
  9855. console.toString = function () {
  9856. return _console.toString();
  9857. };
  9858. return console;
  9859. }(function () {
  9860. 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 () {});
  9861. }), consoleClear: function consoleClear() {
  9862. a.debug("Disabling programmatic console clearing"), t.console.clear = function () {};
  9863. }, requestAnimationFrame: function requestAnimationFrame() {
  9864. 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) {
  9865. setTimeout(e, 0);
  9866. });
  9867. } }, moduleExists: function moduleExists(t) {
  9868. return e.fn[t] !== i && e.fn[t].settings !== i;
  9869. }, enabled: { modules: function modules(t) {
  9870. var n = [];return t = t || f.modules, e.each(t, function (e, t) {
  9871. a.moduleExists(t) && n.push(t);
  9872. }), n;
  9873. } }, disabled: { modules: function modules(t) {
  9874. var n = [];return t = t || f.modules, e.each(t, function (e, t) {
  9875. a.moduleExists(t) || n.push(t);
  9876. }), n;
  9877. } }, change: { setting: function setting(t, n, o, r) {
  9878. o = "string" == typeof o ? "all" === o ? f.modules : [o] : o || f.modules, r = r === i || r, e.each(o, function (i, o) {
  9879. var s,
  9880. 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)));
  9881. });
  9882. }, settings: function settings(t, n, o) {
  9883. n = "string" == typeof n ? [n] : n || f.modules, o = o === i || o, e.each(n, function (n, i) {
  9884. 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)));
  9885. });
  9886. } }, enable: { console: function console() {
  9887. a.console(!0);
  9888. }, debug: function debug(e, t) {
  9889. e = e || f.modules, a.debug("Enabling debug for modules", e), a.change.setting("debug", !0, e, t);
  9890. }, verbose: function verbose(e, t) {
  9891. e = e || f.modules, a.debug("Enabling verbose debug for modules", e), a.change.setting("verbose", !0, e, t);
  9892. } }, disable: { console: function console() {
  9893. a.console(!1);
  9894. }, debug: function debug(e, t) {
  9895. e = e || f.modules, a.debug("Disabling debug for modules", e), a.change.setting("debug", !1, e, t);
  9896. }, verbose: function verbose(e, t) {
  9897. e = e || f.modules, a.debug("Disabling verbose debug for modules", e), a.change.setting("verbose", !1, e, t);
  9898. } }, console: function console(e) {
  9899. if (e) {
  9900. if (b.cache.console === i) return void a.error(g.console);a.debug("Restoring console function"), t.console = b.cache.console;
  9901. } 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() {} };
  9902. }, destroy: function destroy() {
  9903. a.verbose("Destroying previous site for", h), h.removeData(p);
  9904. }, cache: {}, setting: function setting(t, n) {
  9905. if (e.isPlainObject(t)) e.extend(!0, f, t);else {
  9906. if (n === i) return f[t];f[t] = n;
  9907. }
  9908. }, internal: function internal(t, n) {
  9909. if (e.isPlainObject(t)) e.extend(!0, a, t);else {
  9910. if (n === i) return a[t];a[t] = n;
  9911. }
  9912. }, debug: function debug() {
  9913. f.debug && (f.performance ? a.performance.log(arguments) : (a.debug = Function.prototype.bind.call(console.info, console, f.name + ":"), a.debug.apply(console, arguments)));
  9914. }, verbose: function verbose() {
  9915. 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)));
  9916. }, error: function error() {
  9917. a.error = Function.prototype.bind.call(console.error, console, f.name + ":"), a.error.apply(console, arguments);
  9918. }, performance: { log: function log(e) {
  9919. 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);
  9920. }, display: function display() {
  9921. var t = f.name + ":",
  9922. n = 0;s = !1, clearTimeout(a.performance.timer), e.each(l, function (e, t) {
  9923. n += t["Execution Time"];
  9924. }), 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) {
  9925. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  9926. }), console.groupEnd()), l = [];
  9927. } }, invoke: function invoke(t, n, o) {
  9928. var s,
  9929. l,
  9930. c,
  9931. 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) {
  9932. 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 {
  9933. 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];
  9934. }
  9935. })), 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;
  9936. } }, u ? (b === i && a.initialize(), a.invoke(c)) : (b !== i && a.destroy(), a.initialize()), r !== i ? r : this;
  9937. }, 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) {
  9938. return function (n) {
  9939. return !!e.data(n, t);
  9940. };
  9941. }) : function (t, n, i) {
  9942. return !!e.data(t, i[3]);
  9943. } });
  9944. }(jQuery, window, document), function (e, t, n, i) {
  9945. "use strict";
  9946. t = void 0 !== t && t.Math == Math ? t : "undefined" != typeof self && self.Math == Math ? self : Function("return this")(), e.fn.form = function (t) {
  9947. var o,
  9948. a = e(this),
  9949. r = a.selector || "",
  9950. s = new Date().getTime(),
  9951. l = [],
  9952. c = arguments[0],
  9953. u = arguments[1],
  9954. d = "string" == typeof c,
  9955. f = [].slice.call(arguments, 1);return a.each(function () {
  9956. var m,
  9957. g,
  9958. p,
  9959. h,
  9960. v,
  9961. b,
  9962. y,
  9963. x,
  9964. C,
  9965. w,
  9966. S,
  9967. k,
  9968. T,
  9969. A,
  9970. R,
  9971. P,
  9972. E = e(this),
  9973. F = this,
  9974. O = [],
  9975. D = !1;(P = { initialize: function initialize() {
  9976. 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());
  9977. }, instantiate: function instantiate() {
  9978. P.verbose("Storing instance of module", P), R = P, E.data(T, P);
  9979. }, destroy: function destroy() {
  9980. P.verbose("Destroying previous module", R), P.removeEvents(), E.removeData(T);
  9981. }, refresh: function refresh() {
  9982. 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);
  9983. }, submit: function submit() {
  9984. P.verbose("Submitting form", E), E.submit();
  9985. }, attachEvents: function attachEvents(t, n) {
  9986. n = n || "submit", e(t).on("click" + A, function (e) {
  9987. P[n](), e.preventDefault();
  9988. });
  9989. }, bindEvents: function bindEvents() {
  9990. 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 () {
  9991. var t = e(this),
  9992. n = t.prop("type"),
  9993. i = P.get.changeEvent(n, t);e(this).on(i + A, P.event.field.change);
  9994. });
  9995. }, clear: function clear() {
  9996. m.each(function () {
  9997. var t = e(this),
  9998. n = t.parent(),
  9999. i = t.closest(g),
  10000. o = i.find(x.prompt),
  10001. a = t.data(y.defaultValue) || "",
  10002. r = n.is(x.uiCheckbox),
  10003. 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(""));
  10004. });
  10005. }, reset: function reset() {
  10006. m.each(function () {
  10007. var t = e(this),
  10008. n = t.parent(),
  10009. o = t.closest(g),
  10010. a = o.find(x.prompt),
  10011. r = t.data(y.defaultValue),
  10012. s = n.is(x.uiCheckbox),
  10013. l = n.is(x.uiDropdown),
  10014. 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)));
  10015. });
  10016. }, determine: { isValid: function isValid() {
  10017. var t = !0;return e.each(b, function (e, n) {
  10018. P.validate.field(n, e, !0) || (t = !1);
  10019. }), t;
  10020. } }, is: { bracketedRule: function bracketedRule(e) {
  10021. return e.type && e.type.match(v.regExp.bracket);
  10022. }, shorthandFields: function shorthandFields(e) {
  10023. var t = e[Object.keys(e)[0]];return P.is.shorthandRules(t);
  10024. }, shorthandRules: function shorthandRules(t) {
  10025. return "string" == typeof t || e.isArray(t);
  10026. }, empty: function empty(e) {
  10027. return !e || 0 === e.length || (e.is('input[type="checkbox"]') ? !e.is(":checked") : P.is.blank(e));
  10028. }, blank: function blank(t) {
  10029. return "" === e.trim(t.val());
  10030. }, valid: function valid(t) {
  10031. 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) {
  10032. P.is.valid(e) || (n = !1);
  10033. }), n);
  10034. } }, removeEvents: function removeEvents() {
  10035. E.off(A), m.off(A), h.off(A), m.off(A);
  10036. }, event: { field: { keydown: function keydown(t) {
  10037. var n = e(this),
  10038. i = t.which,
  10039. o = n.is(x.input),
  10040. a = n.is(x.checkbox),
  10041. r = n.closest(x.uiDropdown).length > 0,
  10042. 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);
  10043. }, keyup: function keyup() {
  10044. D = !1;
  10045. }, blur: function blur(t) {
  10046. var n = e(this),
  10047. i = n.closest(g),
  10048. 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);
  10049. }, change: function change(t) {
  10050. var n = e(this),
  10051. i = n.closest(g),
  10052. o = P.get.validation(n);o && ("change" == v.on || i.hasClass(C.error) && v.revalidate) && (clearTimeout(P.timer), P.timer = setTimeout(function () {
  10053. P.debug("Revalidating field", n, P.get.validation(n)), P.validate.field(o);
  10054. }, v.delay));
  10055. } } }, get: { ancillaryValue: function ancillaryValue(e) {
  10056. return !(!e.type || !e.value && !P.is.bracketedRule(e)) && (e.value !== i ? e.value : e.type.match(v.regExp.bracket)[1] + "");
  10057. }, ruleName: function ruleName(e) {
  10058. return P.is.bracketedRule(e) ? e.type.replace(e.type.match(v.regExp.bracket)[0], "") : e.type;
  10059. }, changeEvent: function changeEvent(e, t) {
  10060. return "checkbox" == e || "radio" == e || "hidden" == e || t.is("select") ? "change" : P.get.inputEvent();
  10061. }, inputEvent: function inputEvent() {
  10062. return n.createElement("input").oninput !== i ? "input" : n.createElement("input").onpropertychange !== i ? "propertychange" : "keyup";
  10063. }, fieldsFromShorthand: function fieldsFromShorthand(t) {
  10064. var n = {};return e.each(t, function (t, i) {
  10065. "string" == typeof i && (i = [i]), n[t] = { rules: [] }, e.each(i, function (e, i) {
  10066. n[t].rules.push({ type: i });
  10067. });
  10068. }), n;
  10069. }, prompt: function prompt(t, n) {
  10070. var i,
  10071. o,
  10072. a = P.get.ruleName(t),
  10073. r = P.get.ancillaryValue(t),
  10074. s = P.get.field(n.identifier),
  10075. l = s.val(),
  10076. c = e.isFunction(t.prompt) ? t.prompt(l) : t.prompt || v.prompt[a] || v.text.unspecifiedRule,
  10077. u = -1 !== c.search("{value}"),
  10078. 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;
  10079. }, settings: function settings() {
  10080. if (e.isPlainObject(t)) {
  10081. 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));
  10082. } 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();
  10083. }, field: function field(t) {
  10084. 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/>");
  10085. }, fields: function fields(t) {
  10086. var n = e();return e.each(t, function (e, t) {
  10087. n = n.add(P.get.field(t));
  10088. }), n;
  10089. }, validation: function validation(t) {
  10090. var n, i;return !!b && (e.each(b, function (e, o) {
  10091. i = o.identifier || e, P.get.field(i)[0] == t[0] && (o.identifier = i, n = o);
  10092. }), n || !1);
  10093. }, value: function value(e) {
  10094. var t = [];return t.push(e), P.get.values.call(F, t)[e];
  10095. }, values: function values(t) {
  10096. var n = {};return (e.isArray(t) ? P.get.fields(t) : m).each(function (t, o) {
  10097. var a = e(o),
  10098. r = (a.prop("type"), a.prop("name")),
  10099. s = a.val(),
  10100. l = a.is(x.checkbox),
  10101. c = a.is(x.radio),
  10102. u = -1 !== r.indexOf("[]"),
  10103. 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);
  10104. }), n;
  10105. } }, has: { field: function field(e) {
  10106. 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;
  10107. } }, escape: { string: function string(e) {
  10108. return (e = String(e)).replace(w.escape, "\\$&");
  10109. } }, add: { rule: function rule(e, t) {
  10110. P.add.field(e, t);
  10111. }, field: function field(t, n) {
  10112. var i = {};P.is.shorthandRules(n) ? (n = e.isArray(n) ? n : [n], i[t] = { rules: [] }, e.each(n, function (e, n) {
  10113. i[t].rules.push({ type: n });
  10114. })) : i[t] = n, b = e.extend({}, b, i), P.debug("Adding rules", i, b);
  10115. }, fields: function fields(t) {
  10116. var n;n = t && P.is.shorthandFields(t) ? P.get.fieldsFromShorthand(t) : t, b = e.extend({}, b, n);
  10117. }, prompt: function prompt(t, n) {
  10118. var o = P.get.field(t).closest(g),
  10119. a = o.children(x.prompt),
  10120. 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)));
  10121. }, errors: function errors(e) {
  10122. P.debug("Adding form error messages", e), P.set.error(), p.html(v.templates.error(e));
  10123. } }, remove: { rule: function rule(t, n) {
  10124. 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) {
  10125. -1 !== o.indexOf(n.type) && (P.debug("Removed rule", n.type), b[t].rules.splice(e, 1));
  10126. });
  10127. }, field: function field(t) {
  10128. var n = e.isArray(t) ? t : [t];e.each(n, function (e, t) {
  10129. P.remove.rule(t);
  10130. });
  10131. }, rules: function rules(t, n) {
  10132. e.isArray(t) ? e.each(fields, function (e, t) {
  10133. P.remove.rule(t, n);
  10134. }) : P.remove.rule(t, n);
  10135. }, fields: function fields(e) {
  10136. P.remove.field(e);
  10137. }, prompt: function prompt(t) {
  10138. var n = P.get.field(t).closest(g),
  10139. 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 () {
  10140. o.remove();
  10141. }) : o.fadeOut(v.duration, function () {
  10142. o.remove();
  10143. }));
  10144. } }, set: { success: function success() {
  10145. E.removeClass(C.error).addClass(C.success);
  10146. }, defaults: function defaults() {
  10147. m.each(function () {
  10148. var t = e(this),
  10149. n = t.filter(x.checkbox).length > 0 ? t.is(":checked") : t.val();t.data(y.defaultValue, n);
  10150. });
  10151. }, error: function error() {
  10152. E.removeClass(C.success).addClass(C.error);
  10153. }, value: function value(e, t) {
  10154. var n = {};return n[e] = t, P.set.values.call(F, n);
  10155. }, values: function values(t) {
  10156. e.isEmptyObject(t) || e.each(t, function (t, n) {
  10157. var i,
  10158. o = P.get.field(t),
  10159. a = o.parent(),
  10160. r = e.isArray(n),
  10161. s = a.is(x.uiCheckbox),
  10162. l = a.is(x.uiDropdown),
  10163. 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) {
  10164. i = o.filter('[value="' + t + '"]'), a = i.parent(), i.length > 0 && a.checkbox("check");
  10165. })) : 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)));
  10166. });
  10167. } }, validate: { form: function form(e, t) {
  10168. var n = P.get.values();if (D) return !1;if (O = [], P.determine.isValid()) {
  10169. if (P.debug("Form has no validation errors, submitting"), P.set.success(), !0 !== t) return v.onSuccess.call(F, e, n);
  10170. } 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);
  10171. }, field: function field(t, n, o) {
  10172. o = o === i || o, "string" == typeof t && (P.verbose("Validating field", t), n = t, t = b[t]);var a = t.identifier || n,
  10173. r = P.get.field(a),
  10174. s = !!t.depends && P.get.field(t.depends),
  10175. l = !0,
  10176. 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) {
  10177. 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);
  10178. }), 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);
  10179. }, rule: function rule(t, n) {
  10180. var o = P.get.field(t.identifier),
  10181. a = (n.type, o.val()),
  10182. r = P.get.ancillaryValue(n),
  10183. s = P.get.ruleName(n),
  10184. 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);
  10185. } }, setting: function setting(t, n) {
  10186. if (e.isPlainObject(t)) e.extend(!0, v, t);else {
  10187. if (n === i) return v[t];v[t] = n;
  10188. }
  10189. }, internal: function internal(t, n) {
  10190. if (e.isPlainObject(t)) e.extend(!0, P, t);else {
  10191. if (n === i) return P[t];P[t] = n;
  10192. }
  10193. }, debug: function debug() {
  10194. !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)));
  10195. }, verbose: function verbose() {
  10196. !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)));
  10197. }, error: function error() {
  10198. v.silent || (P.error = Function.prototype.bind.call(console.error, console, v.name + ":"), P.error.apply(console, arguments));
  10199. }, performance: { log: function log(e) {
  10200. 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);
  10201. }, display: function display() {
  10202. var t = v.name + ":",
  10203. n = 0;s = !1, clearTimeout(P.performance.timer), e.each(l, function (e, t) {
  10204. n += t["Execution Time"];
  10205. }), 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) {
  10206. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  10207. }), console.groupEnd()), l = [];
  10208. } }, invoke: function invoke(t, n, a) {
  10209. var r,
  10210. s,
  10211. l,
  10212. 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) {
  10213. 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 {
  10214. 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];
  10215. }
  10216. })), 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;
  10217. } }).initialize();
  10218. }), o !== i ? o : this;
  10219. }, 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() {
  10220. return !0;
  10221. }, onFailure: function onFailure() {
  10222. return !1;
  10223. }, 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) {
  10224. var n = '<ul class="list">';return e.each(t, function (e, t) {
  10225. n += "<li>" + t + "</li>";
  10226. }), e(n += "</ul>");
  10227. }, prompt: function prompt(t) {
  10228. return e("<div/>").addClass("ui basic red pointing prompt label").html(t[0]);
  10229. } }, rules: { empty: function empty(t) {
  10230. return !(t === i || "" === t || e.isArray(t) && 0 === t.length);
  10231. }, checked: function checked() {
  10232. return e(this).filter(":checked").length > 0;
  10233. }, email: function email(t) {
  10234. return e.fn.form.settings.regExp.email.test(t);
  10235. }, url: function url(t) {
  10236. return e.fn.form.settings.regExp.url.test(t);
  10237. }, regExp: function regExp(t, n) {
  10238. if (n instanceof RegExp) return t.match(n);var i,
  10239. 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));
  10240. }, integer: function integer(t, n) {
  10241. var o,
  10242. a,
  10243. r,
  10244. 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);
  10245. }, decimal: function decimal(t) {
  10246. return e.fn.form.settings.regExp.decimal.test(t);
  10247. }, number: function number(t) {
  10248. return e.fn.form.settings.regExp.number.test(t);
  10249. }, is: function is(e, t) {
  10250. return t = "string" == typeof t ? t.toLowerCase() : t, (e = "string" == typeof e ? e.toLowerCase() : e) == t;
  10251. }, isExactly: function isExactly(e, t) {
  10252. return e == t;
  10253. }, not: function not(e, t) {
  10254. return (e = "string" == typeof e ? e.toLowerCase() : e) != (t = "string" == typeof t ? t.toLowerCase() : t);
  10255. }, notExactly: function notExactly(e, t) {
  10256. return e != t;
  10257. }, contains: function contains(t, n) {
  10258. return n = n.replace(e.fn.form.settings.regExp.escape, "\\$&"), -1 !== t.search(new RegExp(n, "i"));
  10259. }, containsExactly: function containsExactly(t, n) {
  10260. return n = n.replace(e.fn.form.settings.regExp.escape, "\\$&"), -1 !== t.search(new RegExp(n));
  10261. }, doesntContain: function doesntContain(t, n) {
  10262. return n = n.replace(e.fn.form.settings.regExp.escape, "\\$&"), -1 === t.search(new RegExp(n, "i"));
  10263. }, doesntContainExactly: function doesntContainExactly(t, n) {
  10264. return n = n.replace(e.fn.form.settings.regExp.escape, "\\$&"), -1 === t.search(new RegExp(n));
  10265. }, minLength: function minLength(e, t) {
  10266. return e !== i && e.length >= t;
  10267. }, length: function length(e, t) {
  10268. return e !== i && e.length >= t;
  10269. }, exactLength: function exactLength(e, t) {
  10270. return e !== i && e.length == t;
  10271. }, maxLength: function maxLength(e, t) {
  10272. return e !== i && e.length <= t;
  10273. }, match: function match(t, n) {
  10274. 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();
  10275. }, different: function different(t, n) {
  10276. 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();
  10277. }, creditCard: function creditCard(t, n) {
  10278. var i,
  10279. o,
  10280. 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] } },
  10281. r = {},
  10282. s = !1,
  10283. l = "string" == typeof n && n.split(",");if ("string" == typeof t && 0 !== t.length) {
  10284. if (t = t.replace(/[\-]/g, ""), l && (e.each(l, function (n, i) {
  10285. (o = a[i]) && (r = { length: -1 !== e.inArray(t.length, o.length), pattern: -1 !== t.search(o.pattern) }).length && r.pattern && (s = !0);
  10286. }), !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--;) {
  10287. f += d[u][parseInt(t.charAt(c), 10)], u ^= 1;
  10288. }return f % 10 == 0 && f > 0;
  10289. }
  10290. }, minCount: function minCount(e, t) {
  10291. return 0 == t || (1 == t ? "" !== e : e.split(",").length >= t);
  10292. }, exactCount: function exactCount(e, t) {
  10293. return 0 == t ? "" === e : 1 == t ? "" !== e && -1 === e.search(",") : e.split(",").length == t;
  10294. }, maxCount: function maxCount(e, t) {
  10295. return 0 != t && (1 == t ? -1 === e.search(",") : e.split(",").length <= t);
  10296. } } };
  10297. }(jQuery, window, document), function (e, t, n, i) {
  10298. "use strict";
  10299. t = void 0 !== t && t.Math == Math ? t : "undefined" != typeof self && self.Math == Math ? self : Function("return this")(), e.fn.accordion = function (n) {
  10300. var o,
  10301. a = e(this),
  10302. r = new Date().getTime(),
  10303. s = [],
  10304. l = arguments[0],
  10305. c = "string" == typeof l,
  10306. u = [].slice.call(arguments, 1);t.requestAnimationFrame || t.mozRequestAnimationFrame || t.webkitRequestAnimationFrame || t.msRequestAnimationFrame;return a.each(function () {
  10307. var d,
  10308. f,
  10309. m = e.isPlainObject(n) ? e.extend(!0, {}, e.fn.accordion.settings, n) : e.extend({}, e.fn.accordion.settings),
  10310. g = m.className,
  10311. p = m.namespace,
  10312. h = m.selector,
  10313. v = m.error,
  10314. b = "." + p,
  10315. y = "module-" + p,
  10316. x = a.selector || "",
  10317. C = e(this),
  10318. w = C.find(h.title),
  10319. S = C.find(h.content),
  10320. k = this,
  10321. T = C.data(y);f = { initialize: function initialize() {
  10322. f.debug("Initializing", C), f.bind.events(), m.observeChanges && f.observeChanges(), f.instantiate();
  10323. }, instantiate: function instantiate() {
  10324. T = f, C.data(y, f);
  10325. }, destroy: function destroy() {
  10326. f.debug("Destroying previous instance", C), C.off(b).removeData(y);
  10327. }, refresh: function refresh() {
  10328. w = C.find(h.title), S = C.find(h.content);
  10329. }, observeChanges: function observeChanges() {
  10330. "MutationObserver" in t && ((d = new MutationObserver(function (e) {
  10331. f.debug("DOM tree modified, updating selector cache"), f.refresh();
  10332. })).observe(k, { childList: !0, subtree: !0 }), f.debug("Setting up mutation observer", d));
  10333. }, bind: { events: function events() {
  10334. f.debug("Binding delegated events"), C.on(m.on + b, h.trigger, f.event.click);
  10335. } }, event: { click: function click() {
  10336. f.toggle.call(this);
  10337. } }, toggle: function toggle(t) {
  10338. var n = t !== i ? "number" == typeof t ? w.eq(t) : e(t).closest(h.title) : e(this).closest(h.title),
  10339. o = n.next(S),
  10340. a = o.hasClass(g.animating),
  10341. r = o.hasClass(g.active),
  10342. s = r && !a,
  10343. 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);
  10344. }, open: function open(t) {
  10345. var n = t !== i ? "number" == typeof t ? w.eq(t) : e(t).closest(h.title) : e(this).closest(h.title),
  10346. o = n.next(S),
  10347. 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 () {
  10348. o.removeClass(g.animating).addClass(g.active), f.reset.display.call(this), m.onOpen.call(this), m.onChange.call(this);
  10349. }));
  10350. }, close: function close(t) {
  10351. var n = t !== i ? "number" == typeof t ? w.eq(t) : e(t).closest(h.title) : e(this).closest(h.title),
  10352. o = n.next(S),
  10353. a = o.hasClass(g.animating),
  10354. 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 () {
  10355. o.removeClass(g.animating).removeClass(g.active), f.reset.display.call(this), m.onClose.call(this), m.onChange.call(this);
  10356. }));
  10357. }, closeOthers: function closeOthers(t) {
  10358. var n,
  10359. o,
  10360. a,
  10361. r = t !== i ? w.eq(t) : e(this).closest(h.title),
  10362. s = r.parents(h.content).prev(h.title),
  10363. l = r.closest(h.accordion),
  10364. c = h.title + "." + g.active + ":visible",
  10365. 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 () {
  10366. e(this).removeClass(g.active), f.reset.display.call(this);
  10367. }));
  10368. }, reset: { display: function display() {
  10369. f.verbose("Removing inline display from element", this), e(this).css("display", ""), "" === e(this).attr("style") && e(this).attr("style", "").removeAttr("style");
  10370. }, opacity: function opacity() {
  10371. f.verbose("Removing inline opacity from element", this), e(this).css("opacity", ""), "" === e(this).attr("style") && e(this).attr("style", "").removeAttr("style");
  10372. } }, setting: function setting(t, n) {
  10373. if (f.debug("Changing setting", t, n), e.isPlainObject(t)) e.extend(!0, m, t);else {
  10374. if (n === i) return m[t];e.isPlainObject(m[t]) ? e.extend(!0, m[t], n) : m[t] = n;
  10375. }
  10376. }, internal: function internal(t, n) {
  10377. if (f.debug("Changing internal", t, n), n === i) return f[t];e.isPlainObject(t) ? e.extend(!0, f, t) : f[t] = n;
  10378. }, debug: function debug() {
  10379. !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)));
  10380. }, verbose: function verbose() {
  10381. !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)));
  10382. }, error: function error() {
  10383. m.silent || (f.error = Function.prototype.bind.call(console.error, console, m.name + ":"), f.error.apply(console, arguments));
  10384. }, performance: { log: function log(e) {
  10385. 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);
  10386. }, display: function display() {
  10387. var t = m.name + ":",
  10388. n = 0;r = !1, clearTimeout(f.performance.timer), e.each(s, function (e, t) {
  10389. n += t["Execution Time"];
  10390. }), 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) {
  10391. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  10392. }), console.groupEnd()), s = [];
  10393. } }, invoke: function invoke(t, n, a) {
  10394. var r,
  10395. s,
  10396. l,
  10397. 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) {
  10398. 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 {
  10399. 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];
  10400. }
  10401. })), 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;
  10402. } }, c ? (T === i && f.initialize(), f.invoke(l)) : (T !== i && T.invoke("destroy"), f.initialize());
  10403. }), o !== i ? o : this;
  10404. }, 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) {
  10405. return -i * (t /= o) * (t - 2) + n;
  10406. } });
  10407. }(jQuery, window, document), function (e, t, n, i) {
  10408. "use strict";
  10409. t = void 0 !== t && t.Math == Math ? t : "undefined" != typeof self && self.Math == Math ? self : Function("return this")(), e.fn.checkbox = function (o) {
  10410. var a,
  10411. r = e(this),
  10412. s = r.selector || "",
  10413. l = new Date().getTime(),
  10414. c = [],
  10415. u = arguments[0],
  10416. d = "string" == typeof u,
  10417. f = [].slice.call(arguments, 1);return r.each(function () {
  10418. var r,
  10419. m,
  10420. g = e.extend(!0, {}, e.fn.checkbox.settings, o),
  10421. p = g.className,
  10422. h = g.namespace,
  10423. v = g.selector,
  10424. b = g.error,
  10425. y = "." + h,
  10426. x = "module-" + h,
  10427. C = e(this),
  10428. w = e(this).children(v.label),
  10429. S = e(this).children(v.input),
  10430. k = S[0],
  10431. T = !1,
  10432. A = !1,
  10433. R = C.data(x),
  10434. P = this;m = { initialize: function initialize() {
  10435. m.verbose("Initializing checkbox", g), m.create.label(), m.bind.events(), m.set.tabbable(), m.hide.input(), m.observeChanges(), m.instantiate(), m.setup();
  10436. }, instantiate: function instantiate() {
  10437. m.verbose("Storing instance of module", m), R = m, C.data(x, m);
  10438. }, destroy: function destroy() {
  10439. m.verbose("Destroying module"), m.unbind.events(), m.show.input(), C.removeData(x);
  10440. }, fix: { reference: function reference() {
  10441. C.is(v.input) && (m.debug("Behavior called on <input> adjusting invoked element"), C = C.closest(v.checkbox), m.refresh());
  10442. } }, setup: function setup() {
  10443. 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();
  10444. }, refresh: function refresh() {
  10445. w = C.children(v.label), S = C.children(v.input), k = S[0];
  10446. }, hide: { input: function input() {
  10447. m.verbose("Modifying <input> z-index to be unselectable"), S.addClass(p.hidden);
  10448. } }, show: { input: function input() {
  10449. m.verbose("Modifying <input> z-index to be selectable"), S.removeClass(p.hidden);
  10450. } }, observeChanges: function observeChanges() {
  10451. "MutationObserver" in t && ((r = new MutationObserver(function (e) {
  10452. m.debug("DOM tree modified, updating selector cache"), m.refresh();
  10453. })).observe(P, { childList: !0, subtree: !0 }), m.debug("Setting up mutation observer", r));
  10454. }, attachEvents: function attachEvents(t, n) {
  10455. 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);
  10456. }, event: { click: function click(t) {
  10457. 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());
  10458. }, keydown: function keydown(e) {
  10459. var t = e.which,
  10460. n = 13,
  10461. 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);
  10462. }, keyup: function keyup(e) {
  10463. A && e.preventDefault();
  10464. } }, check: function check() {
  10465. m.should.allowCheck() && (m.debug("Checking checkbox", S), m.set.checked(), m.should.ignoreCallbacks() || (g.onChecked.call(k), g.onChange.call(k)));
  10466. }, uncheck: function uncheck() {
  10467. m.should.allowUncheck() && (m.debug("Unchecking checkbox"), m.set.unchecked(), m.should.ignoreCallbacks() || (g.onUnchecked.call(k), g.onChange.call(k)));
  10468. }, indeterminate: function indeterminate() {
  10469. 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)));
  10470. }, determinate: function determinate() {
  10471. 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)));
  10472. }, enable: function enable() {
  10473. m.is.enabled() ? m.debug("Checkbox is already enabled") : (m.debug("Enabling checkbox"), m.set.enabled(), g.onEnable.call(k), g.onEnabled.call(k));
  10474. }, disable: function disable() {
  10475. m.is.disabled() ? m.debug("Checkbox is already disabled") : (m.debug("Disabling checkbox"), m.set.disabled(), g.onDisable.call(k), g.onDisabled.call(k));
  10476. }, get: { radios: function radios() {
  10477. var t = m.get.name();return e('input[name="' + t + '"]').closest(v.checkbox);
  10478. }, otherRadios: function otherRadios() {
  10479. return m.get.radios().not(C);
  10480. }, name: function name() {
  10481. return S.attr("name");
  10482. } }, is: { initialLoad: function initialLoad() {
  10483. return T;
  10484. }, radio: function radio() {
  10485. return S.hasClass(p.radio) || "radio" == S.attr("type");
  10486. }, indeterminate: function indeterminate() {
  10487. return S.prop("indeterminate") !== i && S.prop("indeterminate");
  10488. }, checked: function checked() {
  10489. return S.prop("checked") !== i && S.prop("checked");
  10490. }, disabled: function disabled() {
  10491. return S.prop("disabled") !== i && S.prop("disabled");
  10492. }, enabled: function enabled() {
  10493. return !m.is.disabled();
  10494. }, determinate: function determinate() {
  10495. return !m.is.indeterminate();
  10496. }, unchecked: function unchecked() {
  10497. return !m.is.checked();
  10498. } }, should: { allowCheck: function allowCheck() {
  10499. 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);
  10500. }, allowUncheck: function allowUncheck() {
  10501. 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);
  10502. }, allowIndeterminate: function allowIndeterminate() {
  10503. 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);
  10504. }, allowDeterminate: function allowDeterminate() {
  10505. 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);
  10506. }, forceCallbacks: function forceCallbacks() {
  10507. return m.is.initialLoad() && g.fireOnInit;
  10508. }, ignoreCallbacks: function ignoreCallbacks() {
  10509. return T && !g.fireOnInit;
  10510. } }, can: { change: function change() {
  10511. return !(C.hasClass(p.disabled) || C.hasClass(p.readOnly) || S.prop("disabled") || S.prop("readonly"));
  10512. }, uncheck: function uncheck() {
  10513. return "boolean" == typeof g.uncheckable ? g.uncheckable : !m.is.radio();
  10514. } }, set: { initialLoad: function initialLoad() {
  10515. T = !0;
  10516. }, checked: function checked() {
  10517. 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");
  10518. }, unchecked: function unchecked() {
  10519. 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");
  10520. }, indeterminate: function indeterminate() {
  10521. 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());
  10522. }, determinate: function determinate() {
  10523. 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));
  10524. }, disabled: function disabled() {
  10525. 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());
  10526. }, enabled: function enabled() {
  10527. 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());
  10528. }, tabbable: function tabbable() {
  10529. m.verbose("Adding tabindex to checkbox"), S.attr("tabindex") === i && S.attr("tabindex", 0);
  10530. } }, remove: { initialLoad: function initialLoad() {
  10531. T = !1;
  10532. } }, trigger: { change: function change() {
  10533. var e = n.createEvent("HTMLEvents"),
  10534. t = S[0];t && (m.verbose("Triggering native change event"), e.initEvent("change", !0, !1), t.dispatchEvent(e));
  10535. } }, create: { label: function label() {
  10536. 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));
  10537. } }, has: { label: function label() {
  10538. return w.length > 0;
  10539. } }, bind: { events: function events() {
  10540. 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);
  10541. } }, unbind: { events: function events() {
  10542. m.debug("Removing events"), C.off(y);
  10543. } }, uncheckOthers: function uncheckOthers() {
  10544. var e = m.get.otherRadios();m.debug("Unchecking other radios", e), e.removeClass(p.checked);
  10545. }, toggle: function toggle() {
  10546. 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");
  10547. }, setting: function setting(t, n) {
  10548. if (m.debug("Changing setting", t, n), e.isPlainObject(t)) e.extend(!0, g, t);else {
  10549. if (n === i) return g[t];e.isPlainObject(g[t]) ? e.extend(!0, g[t], n) : g[t] = n;
  10550. }
  10551. }, internal: function internal(t, n) {
  10552. if (e.isPlainObject(t)) e.extend(!0, m, t);else {
  10553. if (n === i) return m[t];m[t] = n;
  10554. }
  10555. }, debug: function debug() {
  10556. !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)));
  10557. }, verbose: function verbose() {
  10558. !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)));
  10559. }, error: function error() {
  10560. g.silent || (m.error = Function.prototype.bind.call(console.error, console, g.name + ":"), m.error.apply(console, arguments));
  10561. }, performance: { log: function log(e) {
  10562. 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);
  10563. }, display: function display() {
  10564. var t = g.name + ":",
  10565. n = 0;l = !1, clearTimeout(m.performance.timer), e.each(c, function (e, t) {
  10566. n += t["Execution Time"];
  10567. }), 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) {
  10568. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  10569. }), console.groupEnd()), c = [];
  10570. } }, invoke: function invoke(t, n, o) {
  10571. var r,
  10572. s,
  10573. l,
  10574. 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) {
  10575. 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 {
  10576. 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];
  10577. }
  10578. })), 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;
  10579. } }, d ? (R === i && m.initialize(), m.invoke(u)) : (R !== i && R.invoke("destroy"), m.initialize());
  10580. }), a !== i ? a : this;
  10581. }, 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]" } };
  10582. }(jQuery, window, document), function (e, t, n, i) {
  10583. "use strict";
  10584. t = void 0 !== t && t.Math == Math ? t : "undefined" != typeof self && self.Math == Math ? self : Function("return this")(), e.fn.dimmer = function (t) {
  10585. var o,
  10586. a = e(this),
  10587. r = new Date().getTime(),
  10588. s = [],
  10589. l = arguments[0],
  10590. c = "string" == typeof l,
  10591. u = [].slice.call(arguments, 1);return a.each(function () {
  10592. var d,
  10593. f,
  10594. m,
  10595. g = e.isPlainObject(t) ? e.extend(!0, {}, e.fn.dimmer.settings, t) : e.extend({}, e.fn.dimmer.settings),
  10596. p = g.selector,
  10597. h = g.namespace,
  10598. v = g.className,
  10599. b = g.error,
  10600. y = "." + h,
  10601. x = "module-" + h,
  10602. C = a.selector || "",
  10603. w = "ontouchstart" in n.documentElement ? "touchstart" : "click",
  10604. S = e(this),
  10605. k = this,
  10606. T = S.data(x);(m = { preinitialize: function preinitialize() {
  10607. 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());
  10608. }, initialize: function initialize() {
  10609. m.debug("Initializing dimmer", g), m.bind.events(), m.set.dimmable(), m.instantiate();
  10610. }, instantiate: function instantiate() {
  10611. m.verbose("Storing instance of module", m), T = m, S.data(x, T);
  10612. }, destroy: function destroy() {
  10613. m.verbose("Destroying previous module", d), m.unbind.events(), m.remove.variation(), f.off(y);
  10614. }, bind: { events: function events() {
  10615. 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));
  10616. } }, unbind: { events: function events() {
  10617. m.is.page() && f.get(0).removeEventListener("touchmove", m.event.preventScroll, { passive: !1 }), S.removeData(x), f.off(y);
  10618. } }, event: { click: function click(t) {
  10619. 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());
  10620. }, preventScroll: function preventScroll(e) {
  10621. e.preventDefault();
  10622. } }, addContent: function addContent(t) {
  10623. var n = e(t);m.debug("Add content to dimmer", n), n.parent()[0] !== d[0] && n.detach().appendTo(d);
  10624. }, create: function create() {
  10625. var t = e(g.template.dimmer());return g.dimmerName && (m.debug("Creating named dimmer", g.dimmerName), t.addClass(g.dimmerName)), t.appendTo(f), t;
  10626. }, show: function show(t) {
  10627. 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));
  10628. }, hide: function hide(t) {
  10629. 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");
  10630. }, toggle: function toggle() {
  10631. m.verbose("Toggling dimmer visibility", d), m.is.dimmed() ? m.hide() : m.show();
  10632. }, animate: { show: function show(t) {
  10633. 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() {
  10634. m.set.dimmed();
  10635. }, onComplete: function onComplete() {
  10636. m.set.active(), t();
  10637. } })) : (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 () {
  10638. d.removeAttr("style"), m.set.active(), t();
  10639. }));
  10640. }, hide: function hide(t) {
  10641. 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() {
  10642. m.remove.dimmed();
  10643. }, onComplete: function onComplete() {
  10644. m.remove.active(), t();
  10645. } })) : (m.verbose("Hiding dimmer with javascript"), m.remove.dimmed(), d.stop().fadeOut(m.get.duration(), function () {
  10646. m.remove.active(), d.removeAttr("style"), t();
  10647. }));
  10648. } }, get: { dimmer: function dimmer() {
  10649. return d;
  10650. }, duration: function duration() {
  10651. return "object" == _typeof(g.duration) ? m.is.active() ? g.duration.hide : g.duration.show : g.duration;
  10652. } }, has: { dimmer: function dimmer() {
  10653. return g.dimmerName ? S.find(p.dimmer).filter("." + g.dimmerName).length > 0 : S.find(p.dimmer).length > 0;
  10654. } }, is: { active: function active() {
  10655. return d.hasClass(v.active);
  10656. }, animating: function animating() {
  10657. return d.is(":animated") || d.hasClass(v.animating);
  10658. }, closable: function closable() {
  10659. return "auto" == g.closable ? "hover" != g.on : g.closable;
  10660. }, dimmer: function dimmer() {
  10661. return S.hasClass(v.dimmer);
  10662. }, dimmable: function dimmable() {
  10663. return S.hasClass(v.dimmable);
  10664. }, dimmed: function dimmed() {
  10665. return f.hasClass(v.dimmed);
  10666. }, disabled: function disabled() {
  10667. return f.hasClass(v.disabled);
  10668. }, enabled: function enabled() {
  10669. return !m.is.disabled();
  10670. }, page: function page() {
  10671. return f.is("body");
  10672. }, pageDimmer: function pageDimmer() {
  10673. return d.hasClass(v.pageDimmer);
  10674. } }, can: { show: function show() {
  10675. return !d.hasClass(v.disabled);
  10676. } }, set: { opacity: function opacity(e) {
  10677. var t = d.css("background-color"),
  10678. n = t.split(","),
  10679. i = n && 3 == n.length,
  10680. 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);
  10681. }, active: function active() {
  10682. d.addClass(v.active);
  10683. }, dimmable: function dimmable() {
  10684. f.addClass(v.dimmable);
  10685. }, dimmed: function dimmed() {
  10686. f.addClass(v.dimmed);
  10687. }, pageDimmer: function pageDimmer() {
  10688. d.addClass(v.pageDimmer);
  10689. }, disabled: function disabled() {
  10690. d.addClass(v.disabled);
  10691. }, variation: function variation(e) {
  10692. (e = e || g.variation) && d.addClass(e);
  10693. } }, remove: { active: function active() {
  10694. d.removeClass(v.active);
  10695. }, dimmed: function dimmed() {
  10696. f.removeClass(v.dimmed);
  10697. }, disabled: function disabled() {
  10698. d.removeClass(v.disabled);
  10699. }, variation: function variation(e) {
  10700. (e = e || g.variation) && d.removeClass(e);
  10701. } }, setting: function setting(t, n) {
  10702. if (m.debug("Changing setting", t, n), e.isPlainObject(t)) e.extend(!0, g, t);else {
  10703. if (n === i) return g[t];e.isPlainObject(g[t]) ? e.extend(!0, g[t], n) : g[t] = n;
  10704. }
  10705. }, internal: function internal(t, n) {
  10706. if (e.isPlainObject(t)) e.extend(!0, m, t);else {
  10707. if (n === i) return m[t];m[t] = n;
  10708. }
  10709. }, debug: function debug() {
  10710. !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)));
  10711. }, verbose: function verbose() {
  10712. !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)));
  10713. }, error: function error() {
  10714. g.silent || (m.error = Function.prototype.bind.call(console.error, console, g.name + ":"), m.error.apply(console, arguments));
  10715. }, performance: { log: function log(e) {
  10716. 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);
  10717. }, display: function display() {
  10718. var t = g.name + ":",
  10719. n = 0;r = !1, clearTimeout(m.performance.timer), e.each(s, function (e, t) {
  10720. n += t["Execution Time"];
  10721. }), 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) {
  10722. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  10723. }), console.groupEnd()), s = [];
  10724. } }, invoke: function invoke(t, n, a) {
  10725. var r,
  10726. s,
  10727. l,
  10728. 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) {
  10729. 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 {
  10730. 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];
  10731. }
  10732. })), 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;
  10733. } }).preinitialize(), c ? (T === i && m.initialize(), m.invoke(l)) : (T !== i && T.invoke("destroy"), m.initialize());
  10734. }), o !== i ? o : this;
  10735. }, 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() {
  10736. return e("<div />").attr("class", "ui dimmer");
  10737. } } };
  10738. }(jQuery, window, document), function (e, t, n, i) {
  10739. "use strict";
  10740. t = void 0 !== t && t.Math == Math ? t : "undefined" != typeof self && self.Math == Math ? self : Function("return this")(), e.fn.dropdown = function (o) {
  10741. var a,
  10742. r = e(this),
  10743. s = e(n),
  10744. l = r.selector || "",
  10745. c = "ontouchstart" in n.documentElement,
  10746. u = new Date().getTime(),
  10747. d = [],
  10748. f = arguments[0],
  10749. m = "string" == typeof f,
  10750. g = [].slice.call(arguments, 1);return r.each(function (p) {
  10751. var h,
  10752. v,
  10753. b,
  10754. y,
  10755. x,
  10756. C,
  10757. w,
  10758. S,
  10759. k = e.isPlainObject(o) ? e.extend(!0, {}, e.fn.dropdown.settings, o) : e.extend({}, e.fn.dropdown.settings),
  10760. T = k.className,
  10761. A = k.message,
  10762. R = k.fields,
  10763. P = k.keys,
  10764. E = k.metadata,
  10765. F = k.namespace,
  10766. O = k.regExp,
  10767. D = k.selector,
  10768. q = k.error,
  10769. j = k.templates,
  10770. z = "." + F,
  10771. I = "module-" + F,
  10772. M = e(this),
  10773. L = e(k.context),
  10774. V = M.find(D.text),
  10775. N = M.find(D.search),
  10776. H = M.find(D.sizer),
  10777. U = M.find(D.input),
  10778. W = M.find(D.icon),
  10779. B = M.prev().find(D.text).length > 0 ? M.prev().find(D.text) : M.prev(),
  10780. Q = M.children(D.menu),
  10781. X = Q.find(D.item),
  10782. $ = !1,
  10783. Y = !1,
  10784. Z = !1,
  10785. K = this,
  10786. J = M.data(I);S = { initialize: function initialize() {
  10787. 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());
  10788. }, instantiate: function instantiate() {
  10789. S.verbose("Storing instance of dropdown", S), J = S, M.data(I, S);
  10790. }, destroy: function destroy() {
  10791. 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();
  10792. }, observeChanges: function observeChanges() {
  10793. "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());
  10794. }, disconnect: { menuObserver: function menuObserver() {
  10795. w && w.disconnect();
  10796. }, selectObserver: function selectObserver() {
  10797. C && C.disconnect();
  10798. } }, observe: { select: function select() {
  10799. S.has.input() && C.observe(M[0], { childList: !0, subtree: !0 });
  10800. }, menu: function menu() {
  10801. S.has.menu() && w.observe(Q[0], { childList: !0, subtree: !0 });
  10802. } }, create: { id: function id() {
  10803. x = (Math.random().toString(16) + "000000000").substr(2, 8), y = "." + x, S.verbose("Creating unique id for element", x);
  10804. }, userChoice: function userChoice(t) {
  10805. var n, o, a;return !!(t = t || S.get.userValues()) && (t = e.isArray(t) ? t : [t], e.each(t, function (t, r) {
  10806. !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));
  10807. }), n);
  10808. }, userLabels: function userLabels(t) {
  10809. var n = S.get.userValues();n && (S.debug("Adding user labels", n), e.each(n, function (e, t) {
  10810. S.verbose("Adding custom user value"), S.add.label(t, t);
  10811. }));
  10812. }, menu: function menu() {
  10813. Q = e("<div />").addClass(T.menu).appendTo(M);
  10814. }, sizer: function sizer() {
  10815. H = e("<span />").addClass(T.sizer).insertAfter(N);
  10816. } }, search: function search(e) {
  10817. e = e !== i ? e : S.get.query(), S.verbose("Searching for query", e), S.has.minCharacters(e) ? S.filter(e) : S.hide();
  10818. }, select: { firstUnfiltered: function firstUnfiltered() {
  10819. S.verbose("Selecting first non-filtered element"), S.remove.selectedItem(), X.not(D.unselectable).not(D.addition + D.hidden).eq(0).addClass(T.selected);
  10820. }, nextAvailable: function nextAvailable(e) {
  10821. var t = (e = e.eq(0)).nextAll(D.item).not(D.unselectable).eq(0),
  10822. 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));
  10823. } }, setup: { api: function api() {
  10824. 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);
  10825. }, layout: function layout() {
  10826. 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();
  10827. }, select: function select() {
  10828. 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();
  10829. }, menu: function menu(e) {
  10830. Q.html(j.menu(e, R)), X = Q.find(D.item);
  10831. }, reference: function reference() {
  10832. 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();
  10833. }, returnedObject: function returnedObject() {
  10834. var e = r.slice(0, p),
  10835. t = r.slice(p + 1);r = e.add(M).add(t);
  10836. } }, refresh: function refresh() {
  10837. S.refreshSelectors(), S.refreshData();
  10838. }, refreshItems: function refreshItems() {
  10839. X = Q.find(D.item);
  10840. }, refreshSelectors: function refreshSelectors() {
  10841. 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);
  10842. }, refreshData: function refreshData() {
  10843. S.verbose("Refreshing cached metadata"), X.removeData(E.text).removeData(E.value);
  10844. }, clearData: function clearData() {
  10845. S.verbose("Clearing metadata"), X.removeData(E.text).removeData(E.value), M.removeData(E.defaultText).removeData(E.defaultValue).removeData(E.placeholderText);
  10846. }, toggle: function toggle() {
  10847. S.verbose("Toggling menu visibility"), S.is.active() ? S.hide() : S.show();
  10848. }, show: function show(t) {
  10849. 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()) {
  10850. 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 () {
  10851. S.can.click() && S.bind.intent(), S.has.menuSearch() && S.focusSearch(), S.set.visible(), t.call(K);
  10852. });
  10853. }
  10854. }, hide: function hide(t) {
  10855. 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 () {
  10856. S.remove.visible(), t.call(K);
  10857. }));
  10858. }, hideOthers: function hideOthers() {
  10859. S.verbose("Finding other dropdowns to hide"), r.not(M).has(D.menu + "." + T.visible).dropdown("hide");
  10860. }, hideMenu: function hideMenu() {
  10861. S.verbose("Hiding menu instantaneously"), S.remove.active(), S.remove.visible(), Q.transition("hide");
  10862. }, hideSubMenus: function hideSubMenus() {
  10863. var e = Q.children(D.item).find(D.menu);S.verbose("Hiding sub menus", e), e.transition("hide");
  10864. }, bind: { events: function events() {
  10865. c && S.bind.touchEvents(), S.bind.keyboardEvents(), S.bind.inputEvents(), S.bind.mouseEvents();
  10866. }, touchEvents: function touchEvents() {
  10867. 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);
  10868. }, keyboardEvents: function keyboardEvents() {
  10869. 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);
  10870. }, inputEvents: function inputEvents() {
  10871. S.verbose("Binding input change events"), M.on("change" + z, D.input, S.event.change);
  10872. }, mouseEvents: function mouseEvents() {
  10873. 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);
  10874. }, intent: function intent() {
  10875. 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);
  10876. } }, unbind: { intent: function intent() {
  10877. S.verbose("Removing hide intent event from document"), c && s.off("touchstart" + y).off("touchmove" + y), s.off("click" + y);
  10878. } }, filter: function filter(e) {
  10879. var t = e !== i ? e : S.get.query(),
  10880. n = function n() {
  10881. 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();
  10882. };k.useLabels && S.has.maxSelections() || (k.apiSettings ? S.can.useAPI() ? S.queryRemote(t, function () {
  10883. k.filterRemoteData && S.filterItems(t), n();
  10884. }) : S.error(q.noAPI) : (S.filterItems(t), n()));
  10885. }, queryRemote: function queryRemote(t, n) {
  10886. var i = { errorDuration: !1, cache: "local", throttle: k.throttle, urlData: { query: t }, onError: function onError() {
  10887. S.add.message(A.serverError), n();
  10888. }, onFailure: function onFailure() {
  10889. S.add.message(A.serverError), n();
  10890. }, onSuccess: function onSuccess(t) {
  10891. 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();
  10892. } };M.api("get request") || S.setup.api(), i = e.extend(!0, {}, i, k.apiSettings), M.api("setting", i).api("query");
  10893. }, filterItems: function filterItems(t) {
  10894. var n = t !== i ? t : S.get.query(),
  10895. o = null,
  10896. a = S.escape.string(n),
  10897. r = new RegExp("^" + a, "igm");S.has.query() && (o = [], S.verbose("Searching for matching values", n), X.each(function () {
  10898. var t,
  10899. i,
  10900. a = e(this);if ("both" == k.match || "text" == k.match) {
  10901. 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;
  10902. }if ("both" == k.match || "value" == k.match) {
  10903. 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;
  10904. }
  10905. })), S.debug("Showing only matched items", n), S.remove.filteredItem(), o && X.not(o).addClass(T.filtered);
  10906. }, fuzzySearch: function fuzzySearch(e, t) {
  10907. var n = t.length,
  10908. 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++) {
  10909. for (var r = e.charCodeAt(o); a < n;) {
  10910. if (t.charCodeAt(a++) === r) continue e;
  10911. }return !1;
  10912. }return !0;
  10913. }, exactSearch: function exactSearch(e, t) {
  10914. return e = e.toLowerCase(), (t = t.toLowerCase()).indexOf(e) > -1;
  10915. }, filterActive: function filterActive() {
  10916. k.useLabels && X.filter("." + T.active).addClass(T.filtered);
  10917. }, focusSearch: function focusSearch(e) {
  10918. 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());
  10919. }, forceSelection: function forceSelection() {
  10920. var e = X.not(T.filtered).filter("." + T.selected).eq(0),
  10921. t = X.not(T.filtered).filter("." + T.active).eq(0),
  10922. 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();
  10923. }, change: { values: function values(t) {
  10924. k.allowAdditions || S.clear(), S.debug("Creating dropdown with specified values", t), S.setup.menu({ values: t }), e.each(t, function (e, t) {
  10925. if (1 == t.selected) return S.debug("Setting initial selection to", t.value), S.set.selected(t.value), !0;
  10926. });
  10927. } }, event: { change: function change() {
  10928. Z || (S.debug("Input changed, updating selection"), S.set.selected());
  10929. }, focus: function focus() {
  10930. k.showOnFocus && !$ && S.is.hidden() && !v && S.show();
  10931. }, blur: function blur(e) {
  10932. v = n.activeElement === this, $ || v || (S.remove.activeLabel(), S.hide());
  10933. }, mousedown: function mousedown() {
  10934. S.is.searchSelection() ? b = !0 : $ = !0;
  10935. }, mouseup: function mouseup() {
  10936. S.is.searchSelection() ? b = !1 : $ = !1;
  10937. }, click: function click(t) {
  10938. e(t.target).is(M) && (S.is.focusedOnSearch() ? S.show() : S.focusSearch());
  10939. }, search: { focus: function focus() {
  10940. $ = !0, S.is.multiple() && S.remove.activeLabel(), k.showOnFocus && S.search();
  10941. }, blur: function blur(e) {
  10942. v = n.activeElement === this, S.is.searchSelection() && !b && (Y || v || (k.forceSelection && S.forceSelection(), S.hide())), b = !1;
  10943. } }, icon: { click: function click(e) {
  10944. S.toggle();
  10945. } }, text: { focus: function focus(e) {
  10946. $ = !0, S.focusSearch();
  10947. } }, input: function input(e) {
  10948. (S.is.multiple() || S.is.searchSelection()) && S.set.filtered(), clearTimeout(S.timer), S.timer = setTimeout(S.search, k.delay.search);
  10949. }, label: { click: function click(t) {
  10950. var n = e(this),
  10951. i = M.find(D.label),
  10952. o = i.filter("." + T.active),
  10953. a = n.nextAll("." + T.active),
  10954. r = n.prevAll("." + T.active),
  10955. 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));
  10956. } }, remove: { click: function click() {
  10957. var t = e(this).parent();t.hasClass(T.active) ? S.remove.activeLabels() : S.remove.activeLabels(t);
  10958. } }, test: { toggle: function toggle(e) {
  10959. var t = S.is.multiple() ? S.show : S.toggle;S.is.bubbledLabelClick(e) || S.is.bubbledIconClick(e) || S.determine.eventOnElement(e, t) && e.preventDefault();
  10960. }, touch: function touch(e) {
  10961. S.determine.eventOnElement(e, function () {
  10962. "touchstart" == e.type ? S.timer = setTimeout(function () {
  10963. S.hide();
  10964. }, k.delay.touch) : "touchmove" == e.type && clearTimeout(S.timer);
  10965. }), e.stopPropagation();
  10966. }, hide: function hide(e) {
  10967. S.determine.eventInModule(e, S.hide);
  10968. } }, select: { mutation: function mutation(t) {
  10969. S.debug("<select> modified, recreating menu");var n = !1;e.each(t, function (t, i) {
  10970. if (e(i.target).is("select") || e(i.addedNodes).is("select")) return n = !0, !0;
  10971. }), n && (S.disconnect.selectObserver(), S.refresh(), S.setup.select(), S.set.selected(), S.observe.select());
  10972. } }, menu: { mutation: function mutation(t) {
  10973. var n = t[0],
  10974. i = n.addedNodes ? e(n.addedNodes[0]) : e(!1),
  10975. o = n.removedNodes ? e(n.removedNodes[0]) : e(!1),
  10976. a = i.add(o),
  10977. r = a.is(D.addition) || a.closest(D.addition).length > 0,
  10978. 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());
  10979. }, mousedown: function mousedown() {
  10980. Y = !0;
  10981. }, mouseup: function mouseup() {
  10982. Y = !1;
  10983. } }, item: { mouseenter: function mouseenter(t) {
  10984. var n = e(t.target),
  10985. i = e(this),
  10986. o = i.children(D.menu),
  10987. a = i.siblings(D.item).children(D.menu),
  10988. r = o.length > 0;!(o.find(n).length > 0) && r && (clearTimeout(S.itemTimer), S.itemTimer = setTimeout(function () {
  10989. S.verbose("Showing sub-menu", o), e.each(a, function () {
  10990. S.animate.hide(!1, e(this));
  10991. }), S.animate.show(!1, o);
  10992. }, k.delay.show), t.preventDefault());
  10993. }, mouseleave: function mouseleave(t) {
  10994. var n = e(this).children(D.menu);n.length > 0 && (clearTimeout(S.itemTimer), S.itemTimer = setTimeout(function () {
  10995. S.verbose("Hiding sub-menu", n), S.animate.hide(!1, n);
  10996. }, k.delay.hide));
  10997. }, click: function click(t, i) {
  10998. var o = e(this),
  10999. a = e(t ? t.target : ""),
  11000. r = o.find(D.menu),
  11001. s = S.get.choiceText(o),
  11002. l = S.get.choiceValue(o, s),
  11003. c = r.length > 0,
  11004. 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));
  11005. } }, document: { keydown: function keydown(e) {
  11006. var t = e.which;if (S.is.inObject(t, P)) {
  11007. var n = M.find(D.label),
  11008. i = n.filter("." + T.active),
  11009. o = (i.data(E.value), n.index(i)),
  11010. a = n.length,
  11011. r = i.length > 0,
  11012. s = i.length > 1,
  11013. l = 0 === o,
  11014. c = o + 1 == a,
  11015. u = S.is.searchSelection(),
  11016. d = S.is.focusedOnSearch(),
  11017. f = S.is.focused(),
  11018. 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);
  11019. }
  11020. } }, keydown: function keydown(e) {
  11021. var t = e.which;if (S.is.inObject(t, P)) {
  11022. var n,
  11023. i = X.not(D.unselectable).filter("." + T.selected).eq(0),
  11024. o = Q.children("." + T.active).eq(0),
  11025. a = i.length > 0 ? i : o,
  11026. r = a.length > 0 ? a.siblings(":not(." + T.filtered + ")").addBack() : Q.children(":not(." + T.filtered + ")"),
  11027. s = a.children(D.menu),
  11028. l = a.closest(D.menu),
  11029. c = l.hasClass(T.visible) || l.hasClass(T.animating) || l.parent(D.menu).length > 0,
  11030. u = s.length > 0,
  11031. d = a.length > 0,
  11032. f = a.not(D.unselectable).length > 0,
  11033. 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()) {
  11034. 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) {
  11035. 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();
  11036. }if (t == P.downArrow) {
  11037. 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();
  11038. }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());
  11039. } else m && e.preventDefault(), t != P.downArrow || S.is.visible() || (S.verbose("Down key pressed, showing dropdown"), S.show(), e.preventDefault());
  11040. } else S.has.search() || S.set.selectedLetter(String.fromCharCode(t));
  11041. } }, trigger: { change: function change() {
  11042. var e = n.createEvent("HTMLEvents"),
  11043. t = U[0];t && (S.verbose("Triggering native change event"), e.initEvent("change", !0, !1), t.dispatchEvent(e));
  11044. } }, determine: { selectAction: function selectAction(t, n) {
  11045. 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);
  11046. }, eventInModule: function eventInModule(t, i) {
  11047. var o = e(t.target),
  11048. a = o.closest(n.documentElement).length > 0,
  11049. 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);
  11050. }, eventOnElement: function eventOnElement(t, i) {
  11051. var o = e(t.target),
  11052. a = o.closest(D.siblingLabel),
  11053. r = n.body.contains(t.target),
  11054. s = 0 === M.find(a).length,
  11055. 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);
  11056. } }, action: { nothing: function nothing() {}, activate: function activate(t, n, o) {
  11057. if (n = n !== i ? n : t, S.can.activate(e(o))) {
  11058. if (S.set.selected(n, e(o)), S.is.multiple() && !S.is.allFiltered()) return;S.hideAndClear();
  11059. }
  11060. }, select: function select(t, n, o) {
  11061. if (n = n !== i ? n : t, S.can.activate(e(o))) {
  11062. if (S.set.value(n, t, e(o)), S.is.multiple() && !S.is.allFiltered()) return;S.hideAndClear();
  11063. }
  11064. }, combo: function combo(t, n, o) {
  11065. n = n !== i ? n : t, S.set.selected(n, e(o)), S.hideAndClear();
  11066. }, hide: function hide(e, t, n) {
  11067. S.set.value(t, e), S.hideAndClear();
  11068. } }, get: { id: function id() {
  11069. return x;
  11070. }, defaultText: function defaultText() {
  11071. return M.data(E.defaultText);
  11072. }, defaultValue: function defaultValue() {
  11073. return M.data(E.defaultValue);
  11074. }, placeholderText: function placeholderText() {
  11075. return "auto" != k.placeholder && "string" == typeof k.placeholder ? k.placeholder : M.data(E.placeholderText) || "";
  11076. }, text: function text() {
  11077. return V.text();
  11078. }, query: function query() {
  11079. return e.trim(N.val());
  11080. }, searchWidth: function searchWidth(e) {
  11081. return e = e !== i ? e : N.val(), H.text(e), Math.ceil(H.width() + 1);
  11082. }, selectionCount: function selectionCount() {
  11083. var t = S.get.values();return S.is.multiple() ? e.isArray(t) ? t.length : 0 : "" !== S.get.value() ? 1 : 0;
  11084. }, transition: function transition(e) {
  11085. return "auto" == k.transition ? S.is.upward(e) ? "slide up" : "slide down" : k.transition;
  11086. }, userValues: function userValues() {
  11087. var t = S.get.values();return !!t && (t = e.isArray(t) ? t : [t], e.grep(t, function (e) {
  11088. return !1 === S.get.item(e);
  11089. }));
  11090. }, uniqueArray: function uniqueArray(t) {
  11091. return e.grep(t, function (n, i) {
  11092. return e.inArray(n, t) === i;
  11093. });
  11094. }, caretPosition: function caretPosition() {
  11095. var e,
  11096. t,
  11097. 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;
  11098. }, value: function value() {
  11099. var t = U.length > 0 ? U.val() : M.data(E.value),
  11100. n = e.isArray(t) && 1 === t.length && "" === t[0];return t === i || n ? "" : t;
  11101. }, values: function values() {
  11102. var e = S.get.value();return "" === e ? "" : !S.has.selectInput() && S.is.multiple() ? "string" == typeof e ? e.split(k.delimiter) : "" : e;
  11103. }, remoteValues: function remoteValues() {
  11104. var t = S.get.values(),
  11105. n = !1;return t && ("string" == typeof t && (t = [t]), e.each(t, function (e, t) {
  11106. var i = S.read.remoteData(t);S.verbose("Restoring value from session data", i, t), i && (n || (n = {}), n[t] = i);
  11107. })), n;
  11108. }, choiceText: function choiceText(t, n) {
  11109. 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());
  11110. }, choiceValue: function choiceValue(t, n) {
  11111. 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));
  11112. }, inputEvent: function inputEvent() {
  11113. var e = N[0];return !!e && (e.oninput !== i ? "input" : e.onpropertychange !== i ? "propertychange" : "keyup");
  11114. }, selectValues: function selectValues() {
  11115. var t = { values: [] };return M.find("option").each(function () {
  11116. var n = e(this),
  11117. o = n.html(),
  11118. a = n.attr("disabled"),
  11119. 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 });
  11120. }), 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) {
  11121. return e.name > t.name ? 1 : -1;
  11122. }), S.debug("Retrieved and sorted values from select", t)) : S.debug("Retrieved values from select", t), t;
  11123. }, activeItem: function activeItem() {
  11124. return X.filter("." + T.active);
  11125. }, selectedItem: function selectedItem() {
  11126. var e = X.not(D.unselectable).filter("." + T.selected);return e.length > 0 ? e : X.eq(0);
  11127. }, itemWithAdditions: function itemWithAdditions(e) {
  11128. var t = S.get.item(e),
  11129. n = S.create.userChoice(e);return n && n.length > 0 && (t = t.length > 0 ? t.add(n) : n), t;
  11130. }, item: function item(t, n) {
  11131. var o,
  11132. a,
  11133. 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 () {
  11134. var o = e(this),
  11135. s = S.get.choiceText(o),
  11136. 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) {
  11137. if (S.verbose("Ambiguous dropdown value using strict type check", o, t), l === t || s === t) return r = o, !0;
  11138. } else if (String(l) == String(t) || s == t) return S.verbose("Found select item by value", l, t), r = o, !0;
  11139. }), r;
  11140. } }, check: { maxSelections: function maxSelections(e) {
  11141. 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));
  11142. } }, restore: { defaults: function defaults() {
  11143. S.clear(), S.restore.defaultText(), S.restore.defaultValue();
  11144. }, defaultText: function defaultText() {
  11145. 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));
  11146. }, placeholderText: function placeholderText() {
  11147. S.set.placeholderText();
  11148. }, defaultValue: function defaultValue() {
  11149. 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()));
  11150. }, labels: function labels() {
  11151. k.allowAdditions && (k.useLabels || (S.error(q.labels), k.useLabels = !0), S.debug("Restoring selected values"), S.create.userLabels()), S.check.maxSelections();
  11152. }, selected: function selected() {
  11153. S.restore.values(), S.is.multiple() ? (S.debug("Restoring previously selected values and labels"), S.restore.labels()) : S.debug("Restoring previously selected values");
  11154. }, values: function values() {
  11155. S.set.initialLoad(), k.apiSettings && k.saveRemoteData && S.get.remoteValues() ? S.restore.remoteValues() : S.set.selected(), S.remove.initialLoad();
  11156. }, remoteValues: function remoteValues() {
  11157. var t = S.get.remoteValues();S.debug("Recreating selected from session data", t), t && (S.is.single() ? e.each(t, function (e, t) {
  11158. S.set.text(t);
  11159. }) : e.each(t, function (e, t) {
  11160. S.add.label(e, t);
  11161. }));
  11162. } }, read: { remoteData: function remoteData(e) {
  11163. var n;if (t.Storage !== i) return (n = sessionStorage.getItem(e)) !== i && n;S.error(q.noStorage);
  11164. } }, save: { defaults: function defaults() {
  11165. S.save.defaultText(), S.save.placeholderText(), S.save.defaultValue();
  11166. }, defaultValue: function defaultValue() {
  11167. var e = S.get.value();S.verbose("Saving default value as", e), M.data(E.defaultValue, e);
  11168. }, defaultText: function defaultText() {
  11169. var e = S.get.text();S.verbose("Saving default text as", e), M.data(E.defaultText, e);
  11170. }, placeholderText: function placeholderText() {
  11171. 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));
  11172. }, remoteData: function remoteData(e, n) {
  11173. t.Storage !== i ? (S.verbose("Saving remote data to session storage", n, e), sessionStorage.setItem(n, e)) : S.error(q.noStorage);
  11174. } }, clear: function clear() {
  11175. S.is.multiple() && k.useLabels ? S.remove.labels() : (S.remove.activeItem(), S.remove.selectedItem()), S.set.placeholderText(), S.clearValue();
  11176. }, clearValue: function clearValue() {
  11177. S.set.value("");
  11178. }, scrollPage: function scrollPage(e, t) {
  11179. var n,
  11180. i,
  11181. o = t || S.get.selectedItem(),
  11182. a = o.closest(D.menu),
  11183. r = a.outerHeight(),
  11184. s = a.scrollTop(),
  11185. l = X.eq(0).outerHeight(),
  11186. c = Math.floor(r / l),
  11187. u = (a.prop("scrollHeight"), "up" == e ? s - l * c : s + l * c),
  11188. 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));
  11189. }, set: { filtered: function filtered() {
  11190. var e = S.is.multiple(),
  11191. t = S.is.searchSelection(),
  11192. n = e && t,
  11193. i = t ? S.get.query() : "",
  11194. o = "string" == typeof i && i.length > 0,
  11195. a = S.get.searchWidth(),
  11196. 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));
  11197. }, empty: function empty() {
  11198. M.addClass(T.empty);
  11199. }, loading: function loading() {
  11200. M.addClass(T.loading);
  11201. }, placeholderText: function placeholderText(e) {
  11202. e = e || S.get.placeholderText(), S.debug("Setting placeholder text", e), S.set.text(e), V.addClass(T.placeholder);
  11203. }, tabbable: function tabbable() {
  11204. 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)));
  11205. }, initialLoad: function initialLoad() {
  11206. S.verbose("Setting initial load"), h = !0;
  11207. }, activeItem: function activeItem(e) {
  11208. k.allowAdditions && e.filter(D.addition).length > 0 ? e.addClass(T.filtered) : e.addClass(T.active);
  11209. }, partialSearch: function partialSearch(e) {
  11210. var t = S.get.query().length;N.val(e.substr(0, t));
  11211. }, scrollPosition: function scrollPosition(e, t) {
  11212. 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));
  11213. }, text: function text(e) {
  11214. "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)));
  11215. }, selectedItem: function selectedItem(e) {
  11216. var t = S.get.choiceValue(e),
  11217. n = S.get.choiceText(e, !1),
  11218. 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);
  11219. }, selectedLetter: function selectedLetter(t) {
  11220. var n,
  11221. i = X.filter("." + T.selected),
  11222. 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 () {
  11223. if (S.has.firstLetter(e(this), t)) return o = e(this), !1;
  11224. }), 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));
  11225. }, direction: function direction(e) {
  11226. "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);
  11227. }, upward: function upward(e) {
  11228. (e || M).addClass(T.upward);
  11229. }, leftward: function leftward(e) {
  11230. (e || Q).addClass(T.leftward);
  11231. }, value: function value(e, t, n) {
  11232. var o = S.escape.value(e),
  11233. a = U.length > 0,
  11234. r = S.get.values(),
  11235. s = e !== i ? String(e) : e;if (a) {
  11236. 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;
  11237. } 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);
  11238. }, active: function active() {
  11239. M.addClass(T.active);
  11240. }, multiple: function multiple() {
  11241. M.addClass(T.multiple);
  11242. }, visible: function visible() {
  11243. M.addClass(T.visible);
  11244. }, exactly: function exactly(e, t) {
  11245. S.debug("Setting selected to exact values"), S.clear(), S.set.selected(e, t);
  11246. }, selected: function selected(t, n) {
  11247. 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 () {
  11248. var t = e(this),
  11249. o = S.get.choiceText(t),
  11250. a = S.get.choiceValue(t, o),
  11251. r = t.hasClass(T.filtered),
  11252. s = t.hasClass(T.active),
  11253. l = t.hasClass(T.addition),
  11254. 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));
  11255. }));
  11256. } }, add: { label: function label(t, n, i) {
  11257. var o,
  11258. a = S.is.searchSelection() ? N : V,
  11259. 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)));
  11260. }, message: function message(t) {
  11261. var n = Q.children(D.message),
  11262. i = k.templates.message(S.add.variables(t));n.length > 0 ? n.html(i) : n = e("<div/>").html(i).addClass(T.message).appendTo(Q);
  11263. }, optionValue: function optionValue(t) {
  11264. 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());
  11265. }, userSuggestion: function userSuggestion(e) {
  11266. var t,
  11267. n = Q.children(D.addition),
  11268. i = S.get.item(e),
  11269. o = i && i.not(D.addition).length,
  11270. 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()));
  11271. }, variables: function variables(e, t) {
  11272. var n,
  11273. i,
  11274. o = -1 !== e.search("{count}"),
  11275. a = -1 !== e.search("{maxCount}"),
  11276. 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;
  11277. }, value: function value(t, n, i) {
  11278. var o,
  11279. 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");
  11280. } }, remove: { active: function active() {
  11281. M.removeClass(T.active);
  11282. }, activeLabel: function activeLabel() {
  11283. M.find(D.label).removeClass(T.active);
  11284. }, empty: function empty() {
  11285. M.removeClass(T.empty);
  11286. }, loading: function loading() {
  11287. M.removeClass(T.loading);
  11288. }, initialLoad: function initialLoad() {
  11289. h = !1;
  11290. }, upward: function upward(e) {
  11291. (e || M).removeClass(T.upward);
  11292. }, leftward: function leftward(e) {
  11293. (e || Q).removeClass(T.leftward);
  11294. }, visible: function visible() {
  11295. M.removeClass(T.visible);
  11296. }, activeItem: function activeItem() {
  11297. X.removeClass(T.active);
  11298. }, filteredItem: function filteredItem() {
  11299. k.useLabels && S.has.maxSelections() || (k.useLabels && S.is.multiple() ? X.not("." + T.active).removeClass(T.filtered) : X.removeClass(T.filtered), S.remove.empty());
  11300. }, optionValue: function optionValue(e) {
  11301. var t = S.escape.value(e),
  11302. 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 }));
  11303. }, message: function message() {
  11304. Q.children(D.message).remove();
  11305. }, searchWidth: function searchWidth() {
  11306. N.css("width", "");
  11307. }, searchTerm: function searchTerm() {
  11308. S.verbose("Cleared search term"), N.val(""), S.set.filtered();
  11309. }, userAddition: function userAddition() {
  11310. X.filter(D.addition).remove();
  11311. }, selected: function selected(t, n) {
  11312. if (!(n = k.allowAdditions ? n || S.get.itemWithAdditions(t) : n || S.get.item(t))) return !1;n.each(function () {
  11313. var t = e(this),
  11314. n = S.get.choiceText(t),
  11315. 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);
  11316. });
  11317. }, selectedItem: function selectedItem() {
  11318. X.removeClass(T.selected);
  11319. }, value: function value(e, t, n) {
  11320. var i,
  11321. 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();
  11322. }, arrayValue: function arrayValue(t, n) {
  11323. return e.isArray(n) || (n = [n]), n = e.grep(n, function (e) {
  11324. return t != e;
  11325. }), S.verbose("Removed value from delimited string", t, n), n;
  11326. }, label: function label(e, t) {
  11327. var n = M.find(D.label).filter("[data-" + E.value + '="' + S.escape.string(e) + '"]');S.verbose("Removing label", n), n.remove();
  11328. }, activeLabels: function activeLabels(e) {
  11329. e = e || M.find(D.label).filter("." + T.active), S.verbose("Removing active label selections", e), S.remove.labels(e);
  11330. }, labels: function labels(t) {
  11331. t = t || M.find(D.label), S.verbose("Removing labels", t), t.each(function () {
  11332. var t = e(this),
  11333. n = t.data(E.value),
  11334. o = n !== i ? String(n) : n,
  11335. 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");
  11336. });
  11337. }, tabbable: function tabbable() {
  11338. 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"));
  11339. } }, has: { menuSearch: function menuSearch() {
  11340. return S.has.search() && N.closest(Q).length > 0;
  11341. }, search: function search() {
  11342. return N.length > 0;
  11343. }, sizer: function sizer() {
  11344. return H.length > 0;
  11345. }, selectInput: function selectInput() {
  11346. return U.is("select");
  11347. }, minCharacters: function minCharacters(e) {
  11348. return !k.minCharacters || (e = e !== i ? String(e) : String(S.get.query())).length >= k.minCharacters;
  11349. }, firstLetter: function firstLetter(e, t) {
  11350. var n;return !(!e || 0 === e.length || "string" != typeof t) && (n = S.get.choiceText(e, !1), (t = t.toLowerCase()) == String(n).charAt(0).toLowerCase());
  11351. }, input: function input() {
  11352. return U.length > 0;
  11353. }, items: function items() {
  11354. return X.length > 0;
  11355. }, menu: function menu() {
  11356. return Q.length > 0;
  11357. }, message: function message() {
  11358. return 0 !== Q.children(D.message).length;
  11359. }, label: function label(e) {
  11360. var t = S.escape.value(e),
  11361. n = M.find(D.label);return k.ignoreCase && (t = t.toLowerCase()), n.filter("[data-" + E.value + '="' + S.escape.string(t) + '"]').length > 0;
  11362. }, maxSelections: function maxSelections() {
  11363. return k.maxSelections && S.get.selectionCount() >= k.maxSelections;
  11364. }, allResultsFiltered: function allResultsFiltered() {
  11365. var e = X.not(D.addition);return e.filter(D.unselectable).length === e.length;
  11366. }, userSuggestion: function userSuggestion() {
  11367. return Q.children(D.addition).length > 0;
  11368. }, query: function query() {
  11369. return "" !== S.get.query();
  11370. }, value: function value(e) {
  11371. return k.ignoreCase ? S.has.valueIgnoringCase(e) : S.has.valueMatchingCase(e);
  11372. }, valueMatchingCase: function valueMatchingCase(t) {
  11373. var n = S.get.values();return !!(e.isArray(n) ? n && -1 !== e.inArray(t, n) : n == t);
  11374. }, valueIgnoringCase: function valueIgnoringCase(t) {
  11375. var n = S.get.values(),
  11376. i = !1;return e.isArray(n) || (n = [n]), e.each(n, function (e, n) {
  11377. if (String(t).toLowerCase() == String(n).toLowerCase()) return i = !0, !1;
  11378. }), i;
  11379. } }, is: { active: function active() {
  11380. return M.hasClass(T.active);
  11381. }, animatingInward: function animatingInward() {
  11382. return Q.transition("is inward");
  11383. }, animatingOutward: function animatingOutward() {
  11384. return Q.transition("is outward");
  11385. }, bubbledLabelClick: function bubbledLabelClick(t) {
  11386. return e(t.target).is("select, input") && M.closest("label").length > 0;
  11387. }, bubbledIconClick: function bubbledIconClick(t) {
  11388. return e(t.target).closest(W).length > 0;
  11389. }, alreadySetup: function alreadySetup() {
  11390. return M.is("select") && M.parent(D.dropdown).data(I) !== i && 0 === M.prev().length;
  11391. }, animating: function animating(e) {
  11392. return e ? e.transition && e.transition("is animating") : Q.transition && Q.transition("is animating");
  11393. }, leftward: function leftward(e) {
  11394. return (e || Q).hasClass(T.leftward);
  11395. }, disabled: function disabled() {
  11396. return M.hasClass(T.disabled);
  11397. }, focused: function focused() {
  11398. return n.activeElement === M[0];
  11399. }, focusedOnSearch: function focusedOnSearch() {
  11400. return n.activeElement === N[0];
  11401. }, allFiltered: function allFiltered() {
  11402. return (S.is.multiple() || S.has.search()) && !(0 == k.hideAdditions && S.has.userSuggestion()) && !S.has.message() && S.has.allResultsFiltered();
  11403. }, hidden: function hidden(e) {
  11404. return !S.is.visible(e);
  11405. }, initialLoad: function initialLoad() {
  11406. return h;
  11407. }, inObject: function inObject(t, n) {
  11408. var i = !1;return e.each(n, function (e, n) {
  11409. if (n == t) return i = !0, !0;
  11410. }), i;
  11411. }, multiple: function multiple() {
  11412. return M.hasClass(T.multiple);
  11413. }, remote: function remote() {
  11414. return k.apiSettings && S.can.useAPI();
  11415. }, single: function single() {
  11416. return !S.is.multiple();
  11417. }, selectMutation: function selectMutation(t) {
  11418. var n = !1;return e.each(t, function (t, i) {
  11419. if (i.target && e(i.target).is("select")) return n = !0, !0;
  11420. }), n;
  11421. }, search: function search() {
  11422. return M.hasClass(T.search);
  11423. }, searchSelection: function searchSelection() {
  11424. return S.has.search() && 1 === N.parent(D.dropdown).length;
  11425. }, selection: function selection() {
  11426. return M.hasClass(T.selection);
  11427. }, userValue: function userValue(t) {
  11428. return -1 !== e.inArray(t, S.get.userValues());
  11429. }, upward: function upward(e) {
  11430. return (e || M).hasClass(T.upward);
  11431. }, visible: function visible(e) {
  11432. return e ? e.hasClass(T.visible) : Q.hasClass(T.visible);
  11433. }, verticallyScrollableContext: function verticallyScrollableContext() {
  11434. var e = L.get(0) !== t && L.css("overflow-y");return "auto" == e || "scroll" == e;
  11435. }, horizontallyScrollableContext: function horizontallyScrollableContext() {
  11436. var e = L.get(0) !== t && L.css("overflow-X");return "auto" == e || "scroll" == e;
  11437. } }, can: { activate: function activate(e) {
  11438. return !!k.useLabels || !S.has.maxSelections() || !(!S.has.maxSelections() || !e.hasClass(T.active));
  11439. }, openDownward: function openDownward(e) {
  11440. var n,
  11441. i,
  11442. o = e || Q,
  11443. 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;
  11444. }, openRightward: function openRightward(e) {
  11445. var n,
  11446. i,
  11447. o = e || Q,
  11448. 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;
  11449. }, click: function click() {
  11450. return c || "click" == k.on;
  11451. }, extendSelect: function extendSelect() {
  11452. return k.allowAdditions || k.apiSettings;
  11453. }, show: function show() {
  11454. return !S.is.disabled() && (S.has.items() || S.has.message());
  11455. }, useAPI: function useAPI() {
  11456. return e.fn.api !== i;
  11457. } }, animate: { show: function show(t, n) {
  11458. var o,
  11459. a = n || Q,
  11460. r = n ? function () {} : function () {
  11461. S.hideSubMenus(), S.hideOthers(), S.set.active();
  11462. };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() {
  11463. t.call(K);
  11464. } }) : S.error(q.noTransition, o));
  11465. }, hide: function hide(t, n) {
  11466. var o = n || Q,
  11467. a = (n ? k.duration : k.duration, n ? function () {} : function () {
  11468. S.can.click() && S.unbind.intent(), S.remove.active();
  11469. }),
  11470. 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() {
  11471. t.call(K);
  11472. } }) : S.error(q.transition));
  11473. } }, hideAndClear: function hideAndClear() {
  11474. S.remove.searchTerm(), S.has.maxSelections() || (S.has.search() ? S.hide(function () {
  11475. S.remove.filteredItem();
  11476. }) : S.hide());
  11477. }, delay: { show: function show() {
  11478. S.verbose("Delaying show event to ensure user intent"), clearTimeout(S.timer), S.timer = setTimeout(S.show, k.delay.show);
  11479. }, hide: function hide() {
  11480. S.verbose("Delaying hide event to ensure user intent"), clearTimeout(S.timer), S.timer = setTimeout(S.hide, k.delay.hide);
  11481. } }, escape: { value: function value(t) {
  11482. var n = e.isArray(t),
  11483. i = "string" == typeof t,
  11484. o = !i && !n,
  11485. a = i && -1 !== t.search(O.quote),
  11486. r = [];return o || !a ? t : (S.debug("Encoding quote values for use in select", t), n ? (e.each(t, function (e, t) {
  11487. r.push(t.replace(O.quote, "&quot;"));
  11488. }), r) : t.replace(O.quote, "&quot;"));
  11489. }, string: function string(e) {
  11490. return (e = String(e)).replace(O.escape, "\\$&");
  11491. } }, setting: function setting(t, n) {
  11492. if (S.debug("Changing setting", t, n), e.isPlainObject(t)) e.extend(!0, k, t);else {
  11493. if (n === i) return k[t];e.isPlainObject(k[t]) ? e.extend(!0, k[t], n) : k[t] = n;
  11494. }
  11495. }, internal: function internal(t, n) {
  11496. if (e.isPlainObject(t)) e.extend(!0, S, t);else {
  11497. if (n === i) return S[t];S[t] = n;
  11498. }
  11499. }, debug: function debug() {
  11500. !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)));
  11501. }, verbose: function verbose() {
  11502. !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)));
  11503. }, error: function error() {
  11504. k.silent || (S.error = Function.prototype.bind.call(console.error, console, k.name + ":"), S.error.apply(console, arguments));
  11505. }, performance: { log: function log(e) {
  11506. 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);
  11507. }, display: function display() {
  11508. var t = k.name + ":",
  11509. n = 0;u = !1, clearTimeout(S.performance.timer), e.each(d, function (e, t) {
  11510. n += t["Execution Time"];
  11511. }), 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) {
  11512. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  11513. }), console.groupEnd()), d = [];
  11514. } }, invoke: function invoke(t, n, o) {
  11515. var r,
  11516. s,
  11517. l,
  11518. 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) {
  11519. 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 {
  11520. 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];
  11521. }
  11522. })), 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;
  11523. } }, m ? (J === i && S.initialize(), S.invoke(f)) : (J !== i && J.invoke("destroy"), S.initialize());
  11524. }), a !== i ? a : r;
  11525. }, 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) {
  11526. return e(this);
  11527. }, onLabelRemove: function onLabelRemove(e) {
  11528. return !0;
  11529. }, onNoResults: function onNoResults(e) {
  11530. return !0;
  11531. }, 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) {
  11532. var n = t.placeholder || !1,
  11533. 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) {
  11534. i += t.disabled ? '<div class="disabled item" data-value="' + t.value + '">' + t.name + "</div>" : '<div class="item" data-value="' + t.value + '">' + t.name + "</div>";
  11535. }), i += "</div>";
  11536. }, menu: function menu(t, n) {
  11537. var i = t[n.values] || {},
  11538. o = "";return e.each(i, function (e, t) {
  11539. var i = t[n.text] ? 'data-text="' + t[n.text] + '"' : "",
  11540. a = t[n.disabled] ? "disabled " : "";o += '<div class="' + a + 'item" data-value="' + t[n.value] + '"' + i + ">", o += t[n.name], o += "</div>";
  11541. }), o;
  11542. }, label: function label(e, t) {
  11543. return t + '<i class="delete icon"></i>';
  11544. }, message: function message(e) {
  11545. return e;
  11546. }, addition: function addition(e) {
  11547. return e;
  11548. } };
  11549. }(jQuery, window, document), function (e, t, n, i) {
  11550. "use strict";
  11551. t = void 0 !== t && t.Math == Math ? t : "undefined" != typeof self && self.Math == Math ? self : Function("return this")(), e.fn.embed = function (n) {
  11552. var o,
  11553. a = e(this),
  11554. r = a.selector || "",
  11555. s = new Date().getTime(),
  11556. l = [],
  11557. c = arguments[0],
  11558. u = "string" == typeof c,
  11559. d = [].slice.call(arguments, 1);return a.each(function () {
  11560. var f,
  11561. m = e.isPlainObject(n) ? e.extend(!0, {}, e.fn.embed.settings, n) : e.extend({}, e.fn.embed.settings),
  11562. g = m.selector,
  11563. p = m.className,
  11564. h = m.sources,
  11565. v = m.error,
  11566. b = m.metadata,
  11567. y = m.namespace,
  11568. x = m.templates,
  11569. C = "." + y,
  11570. w = "module-" + y,
  11571. S = (e(t), e(this)),
  11572. k = (S.find(g.placeholder), S.find(g.icon), S.find(g.embed)),
  11573. T = this,
  11574. A = S.data(w);f = { initialize: function initialize() {
  11575. f.debug("Initializing embed"), f.determine.autoplay(), f.create(), f.bind.events(), f.instantiate();
  11576. }, instantiate: function instantiate() {
  11577. f.verbose("Storing instance of module", f), A = f, S.data(w, f);
  11578. }, destroy: function destroy() {
  11579. f.verbose("Destroying previous instance of embed"), f.reset(), S.removeData(w).off(C);
  11580. }, refresh: function refresh() {
  11581. f.verbose("Refreshing selector cache"), S.find(g.placeholder), S.find(g.icon), k = S.find(g.embed);
  11582. }, bind: { events: function events() {
  11583. f.has.placeholder() && (f.debug("Adding placeholder events"), S.on("click" + C, g.placeholder, f.createAndShow).on("click" + C, g.icon, f.createAndShow));
  11584. } }, create: function create() {
  11585. f.get.placeholder() ? f.createPlaceholder() : f.createAndShow();
  11586. }, createPlaceholder: function createPlaceholder(e) {
  11587. var t = f.get.icon(),
  11588. 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);
  11589. }, createEmbed: function createEmbed(t) {
  11590. 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);
  11591. }, changeEmbed: function changeEmbed(e) {
  11592. k.html(f.generate.embed(e));
  11593. }, createAndShow: function createAndShow() {
  11594. f.createEmbed(), f.show();
  11595. }, change: function change(e, t, n) {
  11596. 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();
  11597. }, reset: function reset() {
  11598. f.debug("Clearing embed and showing placeholder"), f.remove.active(), f.remove.embed(), f.showPlaceholder(), m.onReset.call(T);
  11599. }, show: function show() {
  11600. f.debug("Showing embed"), f.set.active(), m.onDisplay.call(T);
  11601. }, hide: function hide() {
  11602. f.debug("Hiding embed"), f.showPlaceholder();
  11603. }, showPlaceholder: function showPlaceholder() {
  11604. f.debug("Showing placeholder image"), f.remove.active(), m.onPlaceholderDisplay.call(T);
  11605. }, get: { id: function id() {
  11606. return m.id || S.data(b.id);
  11607. }, placeholder: function placeholder() {
  11608. return m.placeholder || S.data(b.placeholder);
  11609. }, icon: function icon() {
  11610. return m.icon ? m.icon : S.data(b.icon) !== i ? S.data(b.icon) : f.determine.icon();
  11611. }, source: function source(e) {
  11612. return m.source ? m.source : S.data(b.source) !== i ? S.data(b.source) : f.determine.source();
  11613. }, type: function type() {
  11614. var e = f.get.source();return h[e] !== i && h[e].type;
  11615. }, url: function url() {
  11616. return m.url ? m.url : S.data(b.url) !== i ? S.data(b.url) : f.determine.url();
  11617. } }, determine: { autoplay: function autoplay() {
  11618. f.should.autoplay() && (m.autoplay = !0);
  11619. }, source: function source(t) {
  11620. var n = !1;return (t = t || f.get.url()) && e.each(h, function (e, i) {
  11621. if (-1 !== t.search(i.domain)) return n = e, !1;
  11622. }), n;
  11623. }, icon: function icon() {
  11624. var e = f.get.source();return h[e] !== i && h[e].icon;
  11625. }, url: function url() {
  11626. var e,
  11627. t = m.id || S.data(b.id),
  11628. n = m.source || S.data(b.source);return (e = h[n] !== i && h[n].url.replace("{id}", t)) && S.data(b.url, e), e;
  11629. } }, set: { active: function active() {
  11630. S.addClass(p.active);
  11631. } }, remove: { active: function active() {
  11632. S.removeClass(p.active);
  11633. }, embed: function embed() {
  11634. k.empty();
  11635. } }, encode: { parameters: function parameters(e) {
  11636. var t,
  11637. n = [];for (t in e) {
  11638. n.push(encodeURIComponent(t) + "=" + encodeURIComponent(e[t]));
  11639. }return n.join("&amp;");
  11640. } }, generate: { embed: function embed(e) {
  11641. f.debug("Generating embed html");var t,
  11642. n,
  11643. 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;
  11644. }, parameters: function parameters(t, n) {
  11645. 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);
  11646. } }, has: { embed: function embed() {
  11647. return k.length > 0;
  11648. }, placeholder: function placeholder() {
  11649. return m.placeholder || S.data(b.placeholder);
  11650. } }, should: { autoplay: function autoplay() {
  11651. return "auto" === m.autoplay ? m.placeholder || S.data(b.placeholder) !== i : m.autoplay;
  11652. } }, is: { video: function video() {
  11653. return "video" == f.get.type();
  11654. } }, setting: function setting(t, n) {
  11655. if (f.debug("Changing setting", t, n), e.isPlainObject(t)) e.extend(!0, m, t);else {
  11656. if (n === i) return m[t];e.isPlainObject(m[t]) ? e.extend(!0, m[t], n) : m[t] = n;
  11657. }
  11658. }, internal: function internal(t, n) {
  11659. if (e.isPlainObject(t)) e.extend(!0, f, t);else {
  11660. if (n === i) return f[t];f[t] = n;
  11661. }
  11662. }, debug: function debug() {
  11663. !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)));
  11664. }, verbose: function verbose() {
  11665. !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)));
  11666. }, error: function error() {
  11667. m.silent || (f.error = Function.prototype.bind.call(console.error, console, m.name + ":"), f.error.apply(console, arguments));
  11668. }, performance: { log: function log(e) {
  11669. 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);
  11670. }, display: function display() {
  11671. var t = m.name + ":",
  11672. n = 0;s = !1, clearTimeout(f.performance.timer), e.each(l, function (e, t) {
  11673. n += t["Execution Time"];
  11674. }), 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) {
  11675. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  11676. }), console.groupEnd()), l = [];
  11677. } }, invoke: function invoke(t, n, a) {
  11678. var r,
  11679. s,
  11680. l,
  11681. 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) {
  11682. 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 {
  11683. 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];
  11684. }
  11685. })), 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;
  11686. } }, u ? (A === i && f.initialize(), f.invoke(c)) : (A !== i && A.invoke("destroy"), f.initialize());
  11687. }), o !== i ? o : this;
  11688. }, 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) {
  11689. return e;
  11690. }, 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) {
  11691. return { autohide: !e.brandedUI, autoplay: e.autoplay, color: e.color || i, hq: e.hd, jsapi: e.api, modestbranding: !e.brandedUI };
  11692. } }, vimeo: { name: "vimeo", type: "video", icon: "video play", domain: "vimeo.com", url: "//player.vimeo.com/video/{id}", parameters: function parameters(e) {
  11693. return { api: e.api, autoplay: e.autoplay, byline: e.brandedUI, color: e.color || i, portrait: e.brandedUI, title: e.brandedUI };
  11694. } } }, templates: { iframe: function iframe(e, t) {
  11695. var n = e;return t && (n += "?" + t), '<iframe src="' + n + '" width="100%" height="100%" frameborder="0" scrolling="no" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe>';
  11696. }, placeholder: function placeholder(e, t) {
  11697. var n = "";return t && (n += '<i class="' + t + ' icon"></i>'), e && (n += '<img class="placeholder" src="' + e + '">'), n;
  11698. } }, api: !1, onPause: function onPause() {}, onPlay: function onPlay() {}, onStop: function onStop() {} };
  11699. }(jQuery, window, document), function (e, t, n, i) {
  11700. "use strict";
  11701. t = void 0 !== t && t.Math == Math ? t : "undefined" != typeof self && self.Math == Math ? self : Function("return this")(), e.fn.modal = function (o) {
  11702. var a,
  11703. r = e(this),
  11704. s = e(t),
  11705. l = e(n),
  11706. c = e("body"),
  11707. u = r.selector || "",
  11708. d = new Date().getTime(),
  11709. f = [],
  11710. m = arguments[0],
  11711. g = "string" == typeof m,
  11712. p = [].slice.call(arguments, 1),
  11713. h = t.requestAnimationFrame || t.mozRequestAnimationFrame || t.webkitRequestAnimationFrame || t.msRequestAnimationFrame || function (e) {
  11714. setTimeout(e, 0);
  11715. };return r.each(function () {
  11716. var r,
  11717. v,
  11718. b,
  11719. y,
  11720. x,
  11721. C,
  11722. w,
  11723. S,
  11724. k,
  11725. T = e.isPlainObject(o) ? e.extend(!0, {}, e.fn.modal.settings, o) : e.extend({}, e.fn.modal.settings),
  11726. A = T.selector,
  11727. R = T.className,
  11728. P = T.namespace,
  11729. E = T.error,
  11730. F = "." + P,
  11731. O = "module-" + P,
  11732. D = e(this),
  11733. q = e(T.context),
  11734. j = D.find(A.close),
  11735. z = this,
  11736. I = D.data(O),
  11737. M = !1;k = { initialize: function initialize() {
  11738. k.verbose("Initializing dimmer", q), k.create.id(), k.create.dimmer(), k.refreshModals(), k.bind.events(), T.observeChanges && k.observeChanges(), k.instantiate();
  11739. }, instantiate: function instantiate() {
  11740. k.verbose("Storing instance of modal"), I = k, D.data(O, I);
  11741. }, create: { dimmer: function dimmer() {
  11742. var t = { debug: T.debug, variation: !T.centered && "top aligned", dimmerName: "modals" },
  11743. 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);
  11744. }, id: function id() {
  11745. w = (Math.random().toString(16) + "000000000").substr(2, 8), C = "." + w, k.verbose("Creating unique id for element", w);
  11746. } }, destroy: function destroy() {
  11747. k.verbose("Destroying previous modal"), D.removeData(O).off(F), s.off(C), x.off(C), j.off(F), q.dimmer("destroy");
  11748. }, observeChanges: function observeChanges() {
  11749. "MutationObserver" in t && ((S = new MutationObserver(function (e) {
  11750. k.debug("DOM tree modified, refreshing"), k.refresh();
  11751. })).observe(z, { childList: !0, subtree: !0 }), k.debug("Setting up mutation observer", S));
  11752. }, refresh: function refresh() {
  11753. k.remove.scrolling(), k.cacheSizes(), k.set.screenHeight(), k.set.type();
  11754. }, refreshModals: function refreshModals() {
  11755. v = D.siblings(A.modal), r = v.add(D);
  11756. }, attachEvents: function attachEvents(t, n) {
  11757. 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);
  11758. }, bind: { events: function events() {
  11759. 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);
  11760. } }, get: { id: function id() {
  11761. return (Math.random().toString(16) + "000000000").substr(2, 8);
  11762. } }, event: { approve: function approve() {
  11763. M || !1 === T.onApprove.call(z, e(this)) ? k.verbose("Approve callback returned false cancelling hide") : (M = !0, k.hide(function () {
  11764. M = !1;
  11765. }));
  11766. }, deny: function deny() {
  11767. M || !1 === T.onDeny.call(z, e(this)) ? k.verbose("Deny callback returned false cancelling hide") : (M = !0, k.hide(function () {
  11768. M = !1;
  11769. }));
  11770. }, close: function close() {
  11771. k.hide();
  11772. }, click: function click(t) {
  11773. if (T.closable) {
  11774. var i = e(t.target).closest(A.modal).length > 0,
  11775. 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());
  11776. } else k.verbose("Dimmer clicked but closable setting is disabled");
  11777. }, debounce: function debounce(e, t) {
  11778. clearTimeout(k.timer), k.timer = setTimeout(e, t);
  11779. }, keyboard: function keyboard(e) {
  11780. 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());
  11781. }, resize: function resize() {
  11782. y.dimmer("is active") && (k.is.animating() || k.is.active()) && h(k.refresh);
  11783. } }, toggle: function toggle() {
  11784. k.is.active() || k.is.animating() ? k.hide() : k.show();
  11785. }, show: function show(t) {
  11786. t = e.isFunction(t) ? t : function () {}, k.refreshModals(), k.set.dimmerSettings(), k.showModal(t);
  11787. }, hide: function hide(t) {
  11788. t = e.isFunction(t) ? t : function () {}, k.refreshModals(), k.hideModal(t);
  11789. }, showModal: function showModal(t) {
  11790. 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() {
  11791. T.onVisible.apply(z), T.keyboardShortcuts && k.add.keyboardShortcuts(), k.save.focus(), k.set.active(), T.autofocus && k.set.autofocus(), t();
  11792. } })) : k.error(E.noTransition))) : k.debug("Modal is already visible");
  11793. }, hideModal: function hideModal(t, n) {
  11794. 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() {
  11795. k.others.active() || n || k.hideDimmer(), T.keyboardShortcuts && k.remove.keyboardShortcuts();
  11796. }, onComplete: function onComplete() {
  11797. T.onHidden.call(z), k.restore.focus(), t();
  11798. } })) : k.error(E.noTransition)) : k.verbose("Hide callback returned false cancelling hide");
  11799. }, showDimmer: function showDimmer() {
  11800. y.dimmer("is animating") || !y.dimmer("is active") ? (k.debug("Showing dimmer"), y.dimmer("show")) : k.debug("Dimmer already visible");
  11801. }, hideDimmer: function hideDimmer() {
  11802. y.dimmer("is animating") || y.dimmer("is active") ? y.dimmer("hide", function () {
  11803. k.remove.clickaway(), k.remove.screenHeight();
  11804. }) : k.debug("Dimmer is not visible cannot hide");
  11805. }, hideAll: function hideAll(t) {
  11806. 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));
  11807. }, hideOthers: function hideOthers(t) {
  11808. 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));
  11809. }, others: { active: function active() {
  11810. return v.filter("." + R.active).length > 0;
  11811. }, animating: function animating() {
  11812. return v.filter("." + R.animating).length > 0;
  11813. } }, add: { keyboardShortcuts: function keyboardShortcuts() {
  11814. k.verbose("Adding keyboard shortcuts"), l.on("keyup" + F, k.event.keyboard);
  11815. } }, save: { focus: function focus() {
  11816. e(n.activeElement).closest(D).length > 0 || (b = e(n.activeElement).blur());
  11817. } }, restore: { focus: function focus() {
  11818. b && b.length > 0 && b.focus();
  11819. } }, remove: { active: function active() {
  11820. D.removeClass(R.active);
  11821. }, clickaway: function clickaway() {
  11822. x.off("click" + C);
  11823. }, bodyStyle: function bodyStyle() {
  11824. "" === c.attr("style") && (k.verbose("Removing style attribute"), c.removeAttr("style"));
  11825. }, screenHeight: function screenHeight() {
  11826. k.debug("Removing page height"), c.css("height", "");
  11827. }, keyboardShortcuts: function keyboardShortcuts() {
  11828. k.verbose("Removing keyboard shortcuts"), l.off("keyup" + F);
  11829. }, scrolling: function scrolling() {
  11830. y.removeClass(R.scrolling), D.removeClass(R.scrolling);
  11831. } }, cacheSizes: function cacheSizes() {
  11832. D.addClass(R.loading);var o = D.prop("scrollHeight"),
  11833. 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);
  11834. }, can: { fit: function fit() {
  11835. var e = k.cache.contextHeight,
  11836. t = k.cache.contextHeight / 2,
  11837. n = k.cache.topOffset,
  11838. i = k.cache.scrollHeight,
  11839. o = k.cache.height,
  11840. a = T.padding;return i > o ? t + n + i + a < e : o + 2 * a < e;
  11841. } }, is: { active: function active() {
  11842. return D.hasClass(R.active);
  11843. }, animating: function animating() {
  11844. return D.transition("is supported") ? D.transition("is animating") : D.is(":visible");
  11845. }, scrolling: function scrolling() {
  11846. return y.hasClass(R.scrolling);
  11847. }, modernBrowser: function modernBrowser() {
  11848. return !(t.ActiveXObject || "ActiveXObject" in t);
  11849. } }, set: { autofocus: function autofocus() {
  11850. var e = D.find("[tabindex], :input").filter(":visible"),
  11851. t = e.filter("[autofocus]"),
  11852. n = t.length > 0 ? t.first() : e.first();n.length > 0 && n.focus();
  11853. }, clickaway: function clickaway() {
  11854. x.on("click" + C, k.event.click);
  11855. }, dimmerSettings: function dimmerSettings() {
  11856. if (e.fn.dimmer !== i) {
  11857. var t = { debug: T.debug, dimmerName: "modals", closable: "auto", variation: !T.centered && "top aligned", duration: { show: T.duration, hide: T.duration } },
  11858. 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);
  11859. } else k.error(E.dimmer);
  11860. }, screenHeight: function screenHeight() {
  11861. 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));
  11862. }, active: function active() {
  11863. D.addClass(R.active);
  11864. }, scrolling: function scrolling() {
  11865. y.addClass(R.scrolling), D.addClass(R.scrolling);
  11866. }, type: function type() {
  11867. 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());
  11868. }, undetached: function undetached() {
  11869. y.addClass(R.undetached);
  11870. } }, setting: function setting(t, n) {
  11871. if (k.debug("Changing setting", t, n), e.isPlainObject(t)) e.extend(!0, T, t);else {
  11872. if (n === i) return T[t];e.isPlainObject(T[t]) ? e.extend(!0, T[t], n) : T[t] = n;
  11873. }
  11874. }, internal: function internal(t, n) {
  11875. if (e.isPlainObject(t)) e.extend(!0, k, t);else {
  11876. if (n === i) return k[t];k[t] = n;
  11877. }
  11878. }, debug: function debug() {
  11879. !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)));
  11880. }, verbose: function verbose() {
  11881. !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)));
  11882. }, error: function error() {
  11883. T.silent || (k.error = Function.prototype.bind.call(console.error, console, T.name + ":"), k.error.apply(console, arguments));
  11884. }, performance: { log: function log(e) {
  11885. 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);
  11886. }, display: function display() {
  11887. var t = T.name + ":",
  11888. n = 0;d = !1, clearTimeout(k.performance.timer), e.each(f, function (e, t) {
  11889. n += t["Execution Time"];
  11890. }), 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) {
  11891. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  11892. }), console.groupEnd()), f = [];
  11893. } }, invoke: function invoke(t, n, o) {
  11894. var r,
  11895. s,
  11896. l,
  11897. 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) {
  11898. 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 {
  11899. 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];
  11900. }
  11901. })), 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;
  11902. } }, g ? (I === i && k.initialize(), k.invoke(m)) : (I !== i && I.invoke("destroy"), k.initialize());
  11903. }), a !== i ? a : this;
  11904. }, 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() {
  11905. return !0;
  11906. }, onHidden: function onHidden() {}, onApprove: function onApprove() {
  11907. return !0;
  11908. }, onDeny: function onDeny() {
  11909. return !0;
  11910. }, 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" } };
  11911. }(jQuery, window, document), function (e, t, n, i) {
  11912. "use strict";
  11913. t = void 0 !== t && t.Math == Math ? t : "undefined" != typeof self && self.Math == Math ? self : Function("return this")(), e.fn.nag = function (n) {
  11914. var o,
  11915. a = e(this),
  11916. r = a.selector || "",
  11917. s = new Date().getTime(),
  11918. l = [],
  11919. c = arguments[0],
  11920. u = "string" == typeof c,
  11921. d = [].slice.call(arguments, 1);return a.each(function () {
  11922. var a,
  11923. f = e.isPlainObject(n) ? e.extend(!0, {}, e.fn.nag.settings, n) : e.extend({}, e.fn.nag.settings),
  11924. m = (f.className, f.selector),
  11925. g = f.error,
  11926. p = f.namespace,
  11927. h = "." + p,
  11928. v = p + "-module",
  11929. b = e(this),
  11930. y = (b.find(m.close), f.context ? e(f.context) : e("body")),
  11931. x = this,
  11932. C = b.data(v);t.requestAnimationFrame || t.mozRequestAnimationFrame || t.webkitRequestAnimationFrame || t.msRequestAnimationFrame;a = { initialize: function initialize() {
  11933. 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();
  11934. }, destroy: function destroy() {
  11935. a.verbose("Destroying instance"), b.removeData(v).off(h);
  11936. }, show: function show() {
  11937. 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));
  11938. }, hide: function hide() {
  11939. a.debug("Showing nag", f.animation.hide), "fade" == f.animation.show ? b.fadeIn(f.duration, f.easing) : b.slideUp(f.duration, f.easing);
  11940. }, onHide: function onHide() {
  11941. a.debug("Removing nag", f.animation.hide), b.remove(), f.onHide && f.onHide();
  11942. }, dismiss: function dismiss(e) {
  11943. f.storageMethod && a.storage.set(f.key, f.value), a.hide(), e.stopImmediatePropagation(), e.preventDefault();
  11944. }, should: { show: function show() {
  11945. 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);
  11946. } }, get: { storageOptions: function storageOptions() {
  11947. var e = {};return f.expires && (e.expires = f.expires), f.domain && (e.domain = f.domain), f.path && (e.path = f.path), e;
  11948. } }, clear: function clear() {
  11949. a.storage.remove(f.key);
  11950. }, storage: { set: function set(n, o) {
  11951. 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 {
  11952. if (e.cookie === i) return void a.error(g.noCookieStorage);e.cookie(n, o, r), a.debug("Value stored using cookie", n, o, r);
  11953. }
  11954. }, get: function get(n, o) {
  11955. 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;
  11956. }, remove: function remove(n) {
  11957. 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);
  11958. } }, setting: function setting(t, n) {
  11959. if (a.debug("Changing setting", t, n), e.isPlainObject(t)) e.extend(!0, f, t);else {
  11960. if (n === i) return f[t];e.isPlainObject(f[t]) ? e.extend(!0, f[t], n) : f[t] = n;
  11961. }
  11962. }, internal: function internal(t, n) {
  11963. if (e.isPlainObject(t)) e.extend(!0, a, t);else {
  11964. if (n === i) return a[t];a[t] = n;
  11965. }
  11966. }, debug: function debug() {
  11967. !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)));
  11968. }, verbose: function verbose() {
  11969. !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)));
  11970. }, error: function error() {
  11971. f.silent || (a.error = Function.prototype.bind.call(console.error, console, f.name + ":"), a.error.apply(console, arguments));
  11972. }, performance: { log: function log(e) {
  11973. 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);
  11974. }, display: function display() {
  11975. var t = f.name + ":",
  11976. n = 0;s = !1, clearTimeout(a.performance.timer), e.each(l, function (e, t) {
  11977. n += t["Execution Time"];
  11978. }), 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) {
  11979. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  11980. }), console.groupEnd()), l = [];
  11981. } }, invoke: function invoke(t, n, r) {
  11982. var s,
  11983. l,
  11984. c,
  11985. 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) {
  11986. 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 {
  11987. 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];
  11988. }
  11989. })), 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;
  11990. } }, u ? (C === i && a.initialize(), a.invoke(c)) : (C !== i && C.invoke("destroy"), a.initialize());
  11991. }), o !== i ? o : this;
  11992. }, 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) {
  11993. return -i * (t /= o) * (t - 2) + n;
  11994. } });
  11995. }(jQuery, window, document), function (e, t, n, i) {
  11996. "use strict";
  11997. t = void 0 !== t && t.Math == Math ? t : "undefined" != typeof self && self.Math == Math ? self : Function("return this")(), e.fn.popup = function (o) {
  11998. var a,
  11999. r = e(this),
  12000. s = e(n),
  12001. l = e(t),
  12002. c = e("body"),
  12003. u = r.selector || "",
  12004. d = new Date().getTime(),
  12005. f = [],
  12006. m = arguments[0],
  12007. g = "string" == typeof m,
  12008. p = [].slice.call(arguments, 1);return r.each(function () {
  12009. var r,
  12010. h,
  12011. v,
  12012. b,
  12013. y,
  12014. x,
  12015. C = e.isPlainObject(o) ? e.extend(!0, {}, e.fn.popup.settings, o) : e.extend({}, e.fn.popup.settings),
  12016. w = C.selector,
  12017. S = C.className,
  12018. k = C.error,
  12019. T = C.metadata,
  12020. A = C.namespace,
  12021. R = "." + C.namespace,
  12022. P = "module-" + A,
  12023. E = e(this),
  12024. F = e(C.context),
  12025. O = e(C.scrollContext),
  12026. D = e(C.boundary),
  12027. q = C.target ? e(C.target) : E,
  12028. j = 0,
  12029. z = !1,
  12030. I = !1,
  12031. M = this,
  12032. L = E.data(P);x = { initialize: function initialize() {
  12033. x.debug("Initializing", E), x.createID(), x.bind.events(), !x.exists() && C.preserve && x.create(), C.observeChanges && x.observeChanges(), x.instantiate();
  12034. }, instantiate: function instantiate() {
  12035. x.verbose("Storing instance", x), L = x, E.data(P, L);
  12036. }, observeChanges: function observeChanges() {
  12037. "MutationObserver" in t && ((v = new MutationObserver(x.event.documentChanged)).observe(n, { childList: !0, subtree: !0 }), x.debug("Setting up mutation observer", v));
  12038. }, refresh: function refresh() {
  12039. 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();
  12040. }, reposition: function reposition() {
  12041. x.refresh(), x.set.position();
  12042. }, destroy: function destroy() {
  12043. 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);
  12044. }, event: { start: function start(t) {
  12045. var n = e.isPlainObject(C.delay) ? C.delay.show : C.delay;clearTimeout(x.hideTimer), I || (x.showTimer = setTimeout(x.show, n));
  12046. }, end: function end() {
  12047. var t = e.isPlainObject(C.delay) ? C.delay.hide : C.delay;clearTimeout(x.showTimer), x.hideTimer = setTimeout(x.hide, t);
  12048. }, touchstart: function touchstart(e) {
  12049. I = !0, x.show();
  12050. }, resize: function resize() {
  12051. x.is.visible() && x.set.position();
  12052. }, documentChanged: function documentChanged(t) {
  12053. [].forEach.call(t, function (t) {
  12054. t.removedNodes && [].forEach.call(t.removedNodes, function (t) {
  12055. (t == M || e(t).find(M).length > 0) && (x.debug("Element removed from DOM, tearing down events"), x.destroy());
  12056. });
  12057. });
  12058. }, hideGracefully: function hideGracefully(t) {
  12059. var i = e(t.target),
  12060. o = e.contains(n.documentElement, t.target),
  12061. 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");
  12062. } }, create: function create() {
  12063. var t = x.get.html(),
  12064. n = x.get.title(),
  12065. 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);
  12066. }, createID: function createID() {
  12067. y = (Math.random().toString(16) + "000000000").substr(2, 8), b = "." + y, x.verbose("Creating unique id for element", y);
  12068. }, toggle: function toggle() {
  12069. 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());
  12070. }, show: function show(e) {
  12071. if (e = e || function () {}, x.debug("Showing pop-up", C.transition), x.is.hidden() && (!x.is.active() || !x.is.dropdown())) {
  12072. 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));
  12073. }
  12074. }, hide: function hide(e) {
  12075. if (e = e || function () {}, x.is.visible() || x.is.animating()) {
  12076. 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);
  12077. }
  12078. }, hideAll: function hideAll() {
  12079. e(w.popup).filter("." + S.popupVisible).each(function () {
  12080. e(this).data(T.activator).popup("hide");
  12081. });
  12082. }, exists: function exists() {
  12083. return !!r && (C.inline || C.popup ? x.has.popup() : r.closest(F).length >= 1);
  12084. }, removePopup: function removePopup() {
  12085. x.has.popup() && !C.popup && (x.debug("Removing popup", r), r.remove(), r = i, C.onRemove.call(r, M));
  12086. }, save: { conditions: function conditions() {
  12087. x.cache = { title: E.attr("title") }, x.cache.title && E.removeAttr("title"), x.verbose("Saving original attributes", x.cache.title);
  12088. } }, restore: { conditions: function conditions() {
  12089. return x.cache && x.cache.title && (E.attr("title", x.cache.title), x.verbose("Restoring original attributes", x.cache.title)), !0;
  12090. } }, supports: { svg: function svg() {
  12091. return "undefined" == typeof SVGGraphicsElement;
  12092. } }, animate: { show: function show(t) {
  12093. 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() {
  12094. x.bind.close(), t.call(r, M), C.onVisible.call(r, M);
  12095. } })) : x.error(k.noTransition);
  12096. }, hide: function hide(t) {
  12097. 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() {
  12098. x.reset(), t.call(r, M), C.onHidden.call(r, M);
  12099. } }) : x.error(k.noTransition) : x.debug("onHide callback returned false, cancelling popup animation");
  12100. } }, change: { content: function content(e) {
  12101. r.html(e);
  12102. } }, get: { html: function html() {
  12103. return E.removeData(T.html), E.data(T.html) || C.html;
  12104. }, title: function title() {
  12105. return E.removeData(T.title), E.data(T.title) || C.title;
  12106. }, content: function content() {
  12107. return E.removeData(T.content), E.data(T.content) || C.content || E.attr("title");
  12108. }, variation: function variation() {
  12109. return E.removeData(T.variation), E.data(T.variation) || C.variation;
  12110. }, popup: function popup() {
  12111. return r;
  12112. }, popupOffset: function popupOffset() {
  12113. return r.offset();
  12114. }, calculations: function calculations() {
  12115. var e,
  12116. n = x.get.offsetParent(r),
  12117. i = q[0],
  12118. o = D[0] == t,
  12119. a = C.inline || C.popup && C.movePopup ? q.position() : q.offset(),
  12120. s = o ? { top: 0, left: 0 } : D.offset(),
  12121. c = {},
  12122. 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)) {
  12123. var d = n.offset();c.target.top -= d.top, c.target.left -= d.left, c.parent.width = n.outerWidth(), c.parent.height = n.outerHeight();
  12124. }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;
  12125. }, id: function id() {
  12126. return y;
  12127. }, startEvent: function startEvent() {
  12128. return "hover" == C.on ? "mouseenter" : "focus" == C.on && "focus";
  12129. }, scrollEvent: function scrollEvent() {
  12130. return "scroll";
  12131. }, endEvent: function endEvent() {
  12132. return "hover" == C.on ? "mouseleave" : "focus" == C.on && "blur";
  12133. }, distanceFromBoundary: function distanceFromBoundary(e, t) {
  12134. var n,
  12135. i,
  12136. 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;
  12137. }, offsetParent: function offsetParent(t) {
  12138. var n = (t !== i ? t[0] : q[0]).parentNode,
  12139. 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;) {
  12140. n = n.parentNode, a = "none" === (o = e(n)).css("transform"), r = "static" === o.css("position"), s = o.is("body");
  12141. }return o && o.length > 0 ? o : e();
  12142. }, positions: function positions() {
  12143. 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 };
  12144. }, nextPosition: function nextPosition(e) {
  12145. var t = e.split(" "),
  12146. n = t[0],
  12147. i = t[1],
  12148. o = "top" == n || "bottom" == n,
  12149. a = !1,
  12150. r = !1,
  12151. 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;
  12152. } }, set: { position: function position(e, t) {
  12153. if (0 !== q.length && 0 !== r.length) {
  12154. 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) {
  12155. return "left" == e ? "right" : "left";
  12156. }), x.debug("RTL: Popup position updated", e)), j == C.maxSearchDepth && "string" == typeof C.lastResort && (e = C.lastResort), e) {case "top left":
  12157. c = { top: "auto", bottom: l.height - a.top + o, left: a.left + n, right: "auto" };break;case "top center":
  12158. 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":
  12159. c = { bottom: l.height - a.top + o, right: l.width - a.left - a.width - n, top: "auto", left: "auto" };break;case "left center":
  12160. 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":
  12161. 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":
  12162. c = { top: a.top + a.height + o, left: a.left + n, bottom: "auto", right: "auto" };break;case "bottom center":
  12163. 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":
  12164. 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)) {
  12165. 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");
  12166. }return x.debug("Position is on stage", e), x.remove.attempts(), x.remove.loading(), C.setFluidWidth && x.is.fluid() && x.set.fluidWidth(t), !0;
  12167. }x.error(k.notFound);
  12168. }, fluidWidth: function fluidWidth(e) {
  12169. e = e || x.get.calculations(), x.debug("Automatically setting element width to parent width", e.parent.width), r.css("width", e.container.width);
  12170. }, variation: function variation(e) {
  12171. (e = e || x.get.variation()) && x.has.popup() && (x.verbose("Adding variation to popup", e), r.addClass(e));
  12172. }, visible: function visible() {
  12173. E.addClass(S.visible);
  12174. } }, remove: { loading: function loading() {
  12175. r.removeClass(S.loading);
  12176. }, variation: function variation(e) {
  12177. (e = e || x.get.variation()) && (x.verbose("Removing variation", e), r.removeClass(e));
  12178. }, visible: function visible() {
  12179. E.removeClass(S.visible);
  12180. }, attempts: function attempts() {
  12181. x.verbose("Resetting all searched positions"), j = 0, z = !1;
  12182. } }, bind: { events: function events() {
  12183. 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);
  12184. }, popup: function popup() {
  12185. 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);
  12186. }, close: function close() {
  12187. (!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();
  12188. }, closeOnScroll: function closeOnScroll() {
  12189. x.verbose("Binding scroll close event to document"), O.one(x.get.scrollEvent() + b, x.event.hideGracefully);
  12190. }, touchClose: function touchClose() {
  12191. x.verbose("Binding popup touchclose event to document"), s.on("touchstart" + b, function (e) {
  12192. x.verbose("Touched away from popup"), x.event.hideGracefully.call(M, e);
  12193. });
  12194. }, clickaway: function clickaway() {
  12195. x.verbose("Binding popup close event to document"), s.on("click" + b, function (e) {
  12196. x.verbose("Clicked away from popup"), x.event.hideGracefully.call(M, e);
  12197. });
  12198. } }, unbind: { events: function events() {
  12199. l.off(b), E.off(R);
  12200. }, close: function close() {
  12201. s.off(b), O.off(b);
  12202. } }, has: { popup: function popup() {
  12203. return r && r.length > 0;
  12204. } }, should: { centerArrow: function centerArrow(e) {
  12205. return !x.is.basic() && e.target.width <= 2 * C.arrowPixelsFromEdge;
  12206. } }, is: { offstage: function offstage(t, n) {
  12207. var i = [];return e.each(t, function (e, t) {
  12208. t < -C.jitter && (x.debug("Position exceeds allowable distance from edge", e, t, n), i.push(e));
  12209. }), i.length > 0;
  12210. }, svg: function svg(e) {
  12211. return x.supports.svg() && e instanceof SVGGraphicsElement;
  12212. }, basic: function basic() {
  12213. return E.hasClass(S.basic);
  12214. }, active: function active() {
  12215. return E.hasClass(S.active);
  12216. }, animating: function animating() {
  12217. return r !== i && r.hasClass(S.animating);
  12218. }, fluid: function fluid() {
  12219. return r !== i && r.hasClass(S.fluid);
  12220. }, visible: function visible() {
  12221. return r !== i && r.hasClass(S.popupVisible);
  12222. }, dropdown: function dropdown() {
  12223. return E.hasClass(S.dropdown);
  12224. }, hidden: function hidden() {
  12225. return !x.is.visible();
  12226. }, rtl: function rtl() {
  12227. return "rtl" == E.css("direction");
  12228. } }, reset: function reset() {
  12229. x.remove.visible(), C.preserve ? e.fn.transition !== i && r.transition("remove transition") : x.removePopup();
  12230. }, setting: function setting(t, n) {
  12231. if (e.isPlainObject(t)) e.extend(!0, C, t);else {
  12232. if (n === i) return C[t];C[t] = n;
  12233. }
  12234. }, internal: function internal(t, n) {
  12235. if (e.isPlainObject(t)) e.extend(!0, x, t);else {
  12236. if (n === i) return x[t];x[t] = n;
  12237. }
  12238. }, debug: function debug() {
  12239. !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)));
  12240. }, verbose: function verbose() {
  12241. !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)));
  12242. }, error: function error() {
  12243. C.silent || (x.error = Function.prototype.bind.call(console.error, console, C.name + ":"), x.error.apply(console, arguments));
  12244. }, performance: { log: function log(e) {
  12245. 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);
  12246. }, display: function display() {
  12247. var t = C.name + ":",
  12248. n = 0;d = !1, clearTimeout(x.performance.timer), e.each(f, function (e, t) {
  12249. n += t["Execution Time"];
  12250. }), 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) {
  12251. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  12252. }), console.groupEnd()), f = [];
  12253. } }, invoke: function invoke(t, n, o) {
  12254. var r,
  12255. s,
  12256. l,
  12257. 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) {
  12258. 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 {
  12259. 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];
  12260. }
  12261. })), 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;
  12262. } }, g ? (L === i && x.initialize(), x.invoke(m)) : (L !== i && L.invoke("destroy"), x.initialize());
  12263. }), a !== i ? a : this;
  12264. }, 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) {
  12265. var t = { "&": "&amp;", "<": "&lt;", ">": "&gt;", '"': "&quot;", "'": "&#x27;", "`": "&#x60;" };return (/[&<>"'`]/.test(e) ? e.replace(/[&<>"'`]/g, function (e) {
  12266. return t[e];
  12267. }) : e
  12268. );
  12269. }, popup: function popup(t) {
  12270. var n = "",
  12271. 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;
  12272. } } };
  12273. }(jQuery, window, document), function (e, t, n, i) {
  12274. "use strict";
  12275. 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) {
  12276. var o,
  12277. a = e(this),
  12278. r = a.selector || "",
  12279. s = new Date().getTime(),
  12280. l = [],
  12281. c = arguments[0],
  12282. u = "string" == typeof c,
  12283. d = [].slice.call(arguments, 1);return a.each(function () {
  12284. var a,
  12285. f = e.isPlainObject(t) ? e.extend(!0, {}, e.fn.progress.settings, t) : e.extend({}, e.fn.progress.settings),
  12286. m = f.className,
  12287. g = f.metadata,
  12288. p = f.namespace,
  12289. h = f.selector,
  12290. v = f.error,
  12291. b = "." + p,
  12292. y = "module-" + p,
  12293. x = e(this),
  12294. C = e(this).find(h.bar),
  12295. w = e(this).find(h.progress),
  12296. S = e(this).find(h.label),
  12297. k = this,
  12298. T = x.data(y),
  12299. A = !1;a = { initialize: function initialize() {
  12300. a.debug("Initializing progress bar", f), a.set.duration(), a.set.transitionEvent(), a.read.metadata(), a.read.settings(), a.instantiate();
  12301. }, instantiate: function instantiate() {
  12302. a.verbose("Storing instance of progress", a), T = a, x.data(y, a);
  12303. }, destroy: function destroy() {
  12304. a.verbose("Destroying previous progress for", x), clearInterval(T.interval), a.remove.state(), x.removeData(y), T = i;
  12305. }, reset: function reset() {
  12306. a.remove.nextValue(), a.update.progress(0);
  12307. }, complete: function complete() {
  12308. (a.percent === i || a.percent < 100) && (a.remove.progressPoll(), a.set.percent(100));
  12309. }, read: { metadata: function metadata() {
  12310. 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));
  12311. }, settings: function settings() {
  12312. !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));
  12313. } }, bind: { transitionEnd: function transitionEnd(e) {
  12314. var t = a.get.transitionEnd();C.one(t + b, function (t) {
  12315. clearTimeout(a.failSafeTimer), e.call(this, t);
  12316. }), a.failSafeTimer = setTimeout(function () {
  12317. C.triggerHandler(t);
  12318. }, f.duration + f.failSafeDelay), a.verbose("Adding fail safe timer", a.timer);
  12319. } }, increment: function increment(e) {
  12320. 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);
  12321. }, decrement: function decrement(e) {
  12322. 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);
  12323. }, has: { progressPoll: function progressPoll() {
  12324. return a.progressPoll;
  12325. }, total: function total() {
  12326. return !1 !== a.get.total();
  12327. } }, get: { text: function text(e) {
  12328. var t = a.value || 0,
  12329. n = a.total || 0,
  12330. i = A ? a.get.displayPercent() : a.percent || 0,
  12331. 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;
  12332. }, normalizedValue: function normalizedValue(e) {
  12333. if (e < 0) return a.debug("Value cannot decrement below 0"), 0;if (a.has.total()) {
  12334. if (e > a.total) return a.debug("Value cannot increment above total", a.total), a.total;
  12335. } else if (e > 100) return a.debug("Value cannot increment above 100 percent"), 100;return e;
  12336. }, updateInterval: function updateInterval() {
  12337. return "auto" == f.updateInterval ? f.duration : f.updateInterval;
  12338. }, randomValue: function randomValue() {
  12339. return a.debug("Generating random increment percentage"), Math.floor(Math.random() * f.random.max + f.random.min);
  12340. }, numericValue: function numericValue(e) {
  12341. return "string" == typeof e ? "" !== e.replace(/[^\d.]/g, "") && +e.replace(/[^\d.]/g, "") : e;
  12342. }, transitionEnd: function transitionEnd() {
  12343. var e,
  12344. t = n.createElement("element"),
  12345. o = { transition: "transitionend", OTransition: "oTransitionEnd", MozTransition: "transitionend", WebkitTransition: "webkitTransitionEnd" };for (e in o) {
  12346. if (t.style[e] !== i) return o[e];
  12347. }
  12348. }, displayPercent: function displayPercent() {
  12349. var e = C.width(),
  12350. t = x.width(),
  12351. 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);
  12352. }, percent: function percent() {
  12353. return a.percent || 0;
  12354. }, value: function value() {
  12355. return a.nextValue || a.value || 0;
  12356. }, total: function total() {
  12357. return a.total || !1;
  12358. } }, create: { progressPoll: function progressPoll() {
  12359. a.progressPoll = setTimeout(function () {
  12360. a.update.toNextValue(), a.remove.progressPoll();
  12361. }, a.get.updateInterval());
  12362. } }, is: { complete: function complete() {
  12363. return a.is.success() || a.is.warning() || a.is.error();
  12364. }, success: function success() {
  12365. return x.hasClass(m.success);
  12366. }, warning: function warning() {
  12367. return x.hasClass(m.warning);
  12368. }, error: function error() {
  12369. return x.hasClass(m.error);
  12370. }, active: function active() {
  12371. return x.hasClass(m.active);
  12372. }, visible: function visible() {
  12373. return x.is(":visible");
  12374. } }, remove: { progressPoll: function progressPoll() {
  12375. a.verbose("Removing progress poll timer"), a.progressPoll && (clearTimeout(a.progressPoll), delete a.progressPoll);
  12376. }, nextValue: function nextValue() {
  12377. a.verbose("Removing progress value stored for next update"), delete a.nextValue;
  12378. }, state: function state() {
  12379. a.verbose("Removing stored state"), delete a.total, delete a.percent, delete a.value;
  12380. }, active: function active() {
  12381. a.verbose("Removing active state"), x.removeClass(m.active);
  12382. }, success: function success() {
  12383. a.verbose("Removing success state"), x.removeClass(m.success);
  12384. }, warning: function warning() {
  12385. a.verbose("Removing warning state"), x.removeClass(m.warning);
  12386. }, error: function error() {
  12387. a.verbose("Removing error state"), x.removeClass(m.error);
  12388. } }, set: { barWidth: function barWidth(e) {
  12389. 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)));
  12390. }, duration: function duration(e) {
  12391. e = "number" == typeof (e = e || f.duration) ? e + "ms" : e, a.verbose("Setting progress bar transition duration", e), C.css({ "transition-duration": e });
  12392. }, percent: function percent(e) {
  12393. 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);
  12394. }, labelInterval: function labelInterval() {
  12395. clearInterval(a.interval), a.bind.transitionEnd(function () {
  12396. a.verbose("Bar finished animating, removing continuous label updates"), clearInterval(a.interval), A = !1, a.set.labels();
  12397. }), A = !0, a.interval = setInterval(function () {
  12398. e.contains(n.documentElement, k) || (clearInterval(a.interval), A = !1), a.set.labels();
  12399. }, f.framerate);
  12400. }, labels: function labels() {
  12401. a.verbose("Setting both bar progress and outer label text"), a.set.barLabel(), a.set.state();
  12402. }, label: function label(e) {
  12403. (e = e || "") && (e = a.get.text(e), a.verbose("Setting label to text", e), S.text(e));
  12404. }, state: function state(e) {
  12405. 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));
  12406. }, barLabel: function barLabel(e) {
  12407. 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)));
  12408. }, active: function active(e) {
  12409. 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 () {
  12410. f.onActive.call(k, a.value, a.total);
  12411. });
  12412. }, success: function success(e) {
  12413. 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 () {
  12414. f.onSuccess.call(k, a.total);
  12415. });
  12416. }, warning: function warning(e) {
  12417. 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 () {
  12418. f.onWarning.call(k, a.value, a.total);
  12419. });
  12420. }, error: function error(e) {
  12421. 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 () {
  12422. f.onError.call(k, a.value, a.total);
  12423. });
  12424. }, transitionEvent: function transitionEvent() {
  12425. a.get.transitionEnd();
  12426. }, total: function total(e) {
  12427. a.total = e;
  12428. }, value: function value(e) {
  12429. a.value = e;
  12430. }, progress: function progress(e) {
  12431. 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());
  12432. }, nextValue: function nextValue(e) {
  12433. a.nextValue = e;
  12434. } }, update: { toNextValue: function toNextValue() {
  12435. var e = a.nextValue;e && (a.debug("Update interval complete using last updated value", e), a.update.progress(e), a.remove.nextValue());
  12436. }, progress: function progress(e) {
  12437. 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));
  12438. } }, setting: function setting(t, n) {
  12439. if (a.debug("Changing setting", t, n), e.isPlainObject(t)) e.extend(!0, f, t);else {
  12440. if (n === i) return f[t];e.isPlainObject(f[t]) ? e.extend(!0, f[t], n) : f[t] = n;
  12441. }
  12442. }, internal: function internal(t, n) {
  12443. if (e.isPlainObject(t)) e.extend(!0, a, t);else {
  12444. if (n === i) return a[t];a[t] = n;
  12445. }
  12446. }, debug: function debug() {
  12447. !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)));
  12448. }, verbose: function verbose() {
  12449. !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)));
  12450. }, error: function error() {
  12451. f.silent || (a.error = Function.prototype.bind.call(console.error, console, f.name + ":"), a.error.apply(console, arguments));
  12452. }, performance: { log: function log(e) {
  12453. 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);
  12454. }, display: function display() {
  12455. var t = f.name + ":",
  12456. n = 0;s = !1, clearTimeout(a.performance.timer), e.each(l, function (e, t) {
  12457. n += t["Execution Time"];
  12458. }), 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) {
  12459. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  12460. }), console.groupEnd()), l = [];
  12461. } }, invoke: function invoke(t, n, r) {
  12462. var s,
  12463. l,
  12464. c,
  12465. 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) {
  12466. 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 {
  12467. 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];
  12468. }
  12469. })), 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;
  12470. } }, u ? (T === i && a.initialize(), a.invoke(c)) : (T !== i && T.invoke("destroy"), a.initialize());
  12471. }), o !== i ? o : this;
  12472. }, 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) {
  12473. return t;
  12474. }, 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" } };
  12475. }(jQuery, window, document), function (e, t, n, i) {
  12476. "use strict";
  12477. t = void 0 !== t && t.Math == Math ? t : "undefined" != typeof self && self.Math == Math ? self : Function("return this")(), e.fn.rating = function (t) {
  12478. var n,
  12479. o = e(this),
  12480. a = o.selector || "",
  12481. r = new Date().getTime(),
  12482. s = [],
  12483. l = arguments[0],
  12484. c = "string" == typeof l,
  12485. u = [].slice.call(arguments, 1);return o.each(function () {
  12486. var d,
  12487. f,
  12488. m = e.isPlainObject(t) ? e.extend(!0, {}, e.fn.rating.settings, t) : e.extend({}, e.fn.rating.settings),
  12489. g = m.namespace,
  12490. p = m.className,
  12491. h = m.metadata,
  12492. v = m.selector,
  12493. b = (m.error, "." + g),
  12494. y = "module-" + g,
  12495. x = this,
  12496. C = e(this).data(y),
  12497. w = e(this),
  12498. S = w.find(v.icon);f = { initialize: function initialize() {
  12499. 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();
  12500. }, instantiate: function instantiate() {
  12501. f.verbose("Instantiating module", m), C = f, w.data(y, f);
  12502. }, destroy: function destroy() {
  12503. f.verbose("Destroying previous instance", C), f.remove.events(), w.removeData(y);
  12504. }, refresh: function refresh() {
  12505. S = w.find(v.icon);
  12506. }, setup: { layout: function layout() {
  12507. var t = f.get.maxRating(),
  12508. n = e.fn.rating.settings.templates.icon(t);f.debug("Generating icon html dynamically"), w.html(n), f.refresh();
  12509. } }, event: { mouseenter: function mouseenter() {
  12510. var t = e(this);t.nextAll().removeClass(p.selected), w.addClass(p.selected), t.addClass(p.selected).prevAll().addClass(p.selected);
  12511. }, mouseleave: function mouseleave() {
  12512. w.removeClass(p.selected), S.removeClass(p.selected);
  12513. }, click: function click() {
  12514. var t = e(this),
  12515. n = f.get.rating(),
  12516. i = S.index(t) + 1;("auto" == m.clearable ? 1 === S.length : m.clearable) && n == i ? f.clearRating() : f.set.rating(i);
  12517. } }, clearRating: function clearRating() {
  12518. f.debug("Clearing current rating"), f.set.rating(0);
  12519. }, bind: { events: function events() {
  12520. 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);
  12521. } }, remove: { events: function events() {
  12522. f.verbose("Removing events"), w.off(b);
  12523. }, initialLoad: function initialLoad() {
  12524. d = !1;
  12525. } }, enable: function enable() {
  12526. f.debug("Setting rating to interactive mode"), f.bind.events(), w.removeClass(p.disabled);
  12527. }, disable: function disable() {
  12528. f.debug("Setting rating to read-only mode"), f.remove.events(), w.addClass(p.disabled);
  12529. }, is: { initialLoad: function initialLoad() {
  12530. return d;
  12531. } }, get: { initialRating: function initialRating() {
  12532. return w.data(h.rating) !== i ? (w.removeData(h.rating), w.data(h.rating)) : m.initialRating;
  12533. }, maxRating: function maxRating() {
  12534. return w.data(h.maxRating) !== i ? (w.removeData(h.maxRating), w.data(h.maxRating)) : m.maxRating;
  12535. }, rating: function rating() {
  12536. var e = S.filter("." + p.active).length;return f.verbose("Current rating retrieved", e), e;
  12537. } }, set: { rating: function rating(e) {
  12538. var t = e - 1 >= 0 ? e - 1 : 0,
  12539. 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);
  12540. }, initialLoad: function initialLoad() {
  12541. d = !0;
  12542. } }, setting: function setting(t, n) {
  12543. if (f.debug("Changing setting", t, n), e.isPlainObject(t)) e.extend(!0, m, t);else {
  12544. if (n === i) return m[t];e.isPlainObject(m[t]) ? e.extend(!0, m[t], n) : m[t] = n;
  12545. }
  12546. }, internal: function internal(t, n) {
  12547. if (e.isPlainObject(t)) e.extend(!0, f, t);else {
  12548. if (n === i) return f[t];f[t] = n;
  12549. }
  12550. }, debug: function debug() {
  12551. !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)));
  12552. }, verbose: function verbose() {
  12553. !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)));
  12554. }, error: function error() {
  12555. m.silent || (f.error = Function.prototype.bind.call(console.error, console, m.name + ":"), f.error.apply(console, arguments));
  12556. }, performance: { log: function log(e) {
  12557. 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);
  12558. }, display: function display() {
  12559. var t = m.name + ":",
  12560. n = 0;r = !1, clearTimeout(f.performance.timer), e.each(s, function (e, t) {
  12561. n += t["Execution Time"];
  12562. }), 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) {
  12563. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  12564. }), console.groupEnd()), s = [];
  12565. } }, invoke: function invoke(t, o, a) {
  12566. var r,
  12567. s,
  12568. l,
  12569. 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) {
  12570. 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 {
  12571. 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];
  12572. }
  12573. })), 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;
  12574. } }, c ? (C === i && f.initialize(), f.invoke(l)) : (C !== i && C.invoke("destroy"), f.initialize());
  12575. }), n !== i ? n : this;
  12576. }, 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) {
  12577. for (var t = 1, n = ""; t <= e;) {
  12578. n += '<i class="icon"></i>', t++;
  12579. }return n;
  12580. } } };
  12581. }(jQuery, window, document), function (e, t, n, i) {
  12582. "use strict";
  12583. t = void 0 !== t && t.Math == Math ? t : "undefined" != typeof self && self.Math == Math ? self : Function("return this")(), e.fn.search = function (o) {
  12584. var a,
  12585. r = e(this),
  12586. s = r.selector || "",
  12587. l = new Date().getTime(),
  12588. c = [],
  12589. u = arguments[0],
  12590. d = "string" == typeof u,
  12591. f = [].slice.call(arguments, 1);return e(this).each(function () {
  12592. var m,
  12593. g = e.isPlainObject(o) ? e.extend(!0, {}, e.fn.search.settings, o) : e.extend({}, e.fn.search.settings),
  12594. p = g.className,
  12595. h = g.metadata,
  12596. v = g.regExp,
  12597. b = g.fields,
  12598. y = g.selector,
  12599. x = g.error,
  12600. C = g.namespace,
  12601. w = "." + C,
  12602. S = C + "-module",
  12603. k = e(this),
  12604. T = k.find(y.prompt),
  12605. A = k.find(y.searchButton),
  12606. R = k.find(y.results),
  12607. P = k.find(y.result),
  12608. E = (k.find(y.category), this),
  12609. F = k.data(S),
  12610. O = !1,
  12611. D = !1;m = { initialize: function initialize() {
  12612. m.verbose("Initializing module"), m.get.settings(), m.determine.searchFields(), m.bind.events(), m.set.type(), m.create.results(), m.instantiate();
  12613. }, instantiate: function instantiate() {
  12614. m.verbose("Storing instance of module", m), F = m, k.data(S, m);
  12615. }, destroy: function destroy() {
  12616. m.verbose("Destroying instance"), k.off(w).removeData(S);
  12617. }, refresh: function refresh() {
  12618. 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);
  12619. }, refreshResults: function refreshResults() {
  12620. R = k.find(y.results), P = k.find(y.result);
  12621. }, bind: { events: function events() {
  12622. 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);
  12623. } }, determine: { searchFields: function searchFields() {
  12624. o && o.searchFields !== i && (g.searchFields = o.searchFields);
  12625. } }, event: { input: function input() {
  12626. g.searchDelay ? (clearTimeout(m.timer), m.timer = setTimeout(function () {
  12627. m.is.focused() && m.query();
  12628. }, g.searchDelay)) : m.query();
  12629. }, focus: function focus() {
  12630. m.set.focus(), g.searchOnFocus && m.has.minimumCharacters() && m.query(function () {
  12631. m.can.show() && m.showResults();
  12632. });
  12633. }, blur: function blur(e) {
  12634. var t = function t() {
  12635. m.cancel.query(), m.remove.focus(), m.timer = setTimeout(m.hideResults, g.hideDelay);
  12636. };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) {
  12637. m.is.inMessage(e) || O ? T.focus() : (O = !1, m.is.animating() || m.is.hidden() || t());
  12638. })) : (m.debug("Input blurred without user action, closing results"), t()));
  12639. }, result: { mousedown: function mousedown() {
  12640. m.resultsClicked = !0;
  12641. }, mouseup: function mouseup() {
  12642. m.resultsClicked = !1;
  12643. }, click: function click(n) {
  12644. m.debug("Search result selected");var i = e(this),
  12645. o = i.find(y.title).eq(0),
  12646. a = i.is("a[href]") ? i : i.find("a[href]").eq(0),
  12647. r = a.attr("href") || !1,
  12648. s = a.attr("target") || !1,
  12649. l = (o.html(), o.length > 0 && o.text()),
  12650. c = m.get.results(),
  12651. 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);
  12652. } } }, handleKeyboard: function handleKeyboard(e) {
  12653. var t,
  12654. n = k.find(y.result),
  12655. i = k.find(y.category),
  12656. o = n.filter("." + p.active),
  12657. a = n.index(o),
  12658. r = n.length,
  12659. s = o.length > 0,
  12660. l = e.which,
  12661. c = 13,
  12662. u = 38,
  12663. d = 40;if (l == 27 && (m.verbose("Escape key pressed, blurring search field"), m.hideResults(), D = !0), m.is.visible()) {
  12664. if (l == c) {
  12665. 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;
  12666. } 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());
  12667. } else l == c && (m.verbose("Enter key pressed, executing query"), m.query(), m.set.buttonPressed(), T.one("keyup", m.remove.buttonFocus));
  12668. }, setup: { api: function api(t, n) {
  12669. var i = { debug: g.debug, on: !1, cache: g.cache, action: "search", urlData: { query: t }, onSuccess: function onSuccess(e) {
  12670. m.parse.response.call(E, e, t), n();
  12671. }, onFailure: function onFailure() {
  12672. m.displayMessage(x.serverError), n();
  12673. }, onAbort: function onAbort(e) {}, onError: m.error };e.extend(!0, i, g.apiSettings), m.verbose("Setting up API request", i), k.api(i);
  12674. } }, can: { useAPI: function useAPI() {
  12675. return e.fn.api !== i;
  12676. }, show: function show() {
  12677. return m.is.focused() && !m.is.visible() && !m.is.empty();
  12678. }, transition: function transition() {
  12679. return g.transition && e.fn.transition !== i && k.transition("is supported");
  12680. } }, is: { animating: function animating() {
  12681. return R.hasClass(p.animating);
  12682. }, hidden: function hidden() {
  12683. return R.hasClass(p.hidden);
  12684. }, inMessage: function inMessage(t) {
  12685. if (t.target) {
  12686. var i = e(t.target);return e.contains(n.documentElement, t.target) && i.closest(y.message).length > 0;
  12687. }
  12688. }, empty: function empty() {
  12689. return "" === R.html();
  12690. }, visible: function visible() {
  12691. return R.filter(":visible").length > 0;
  12692. }, focused: function focused() {
  12693. return T.filter(":focus").length > 0;
  12694. } }, get: { settings: function settings() {
  12695. e.isPlainObject(o) && o.searchFullText && (g.fullTextSearch = o.searchFullText, m.error(g.error.oldSearchSyntax, E));
  12696. }, inputEvent: function inputEvent() {
  12697. var e = T[0];return e !== i && e.oninput !== i ? "input" : e !== i && e.onpropertychange !== i ? "propertychange" : "keyup";
  12698. }, value: function value() {
  12699. return T.val();
  12700. }, results: function results() {
  12701. return k.data(h.results);
  12702. }, result: function result(t, n) {
  12703. var o = ["title", "id"],
  12704. 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) {
  12705. if (e.isArray(i.results) && (a = m.search.object(t, i.results, o)[0])) return !1;
  12706. })) : (m.debug("Finding result in results object", t), a = m.search.object(t, n, o)[0]), a || !1;
  12707. } }, select: { firstResult: function firstResult() {
  12708. m.verbose("Selecting first result"), P.first().addClass(p.active);
  12709. } }, set: { focus: function focus() {
  12710. k.addClass(p.focus);
  12711. }, loading: function loading() {
  12712. k.addClass(p.loading);
  12713. }, value: function value(e) {
  12714. m.verbose("Setting search input value", e), T.val(e);
  12715. }, type: function type(e) {
  12716. e = e || g.type, "category" == g.type && k.addClass(g.type);
  12717. }, buttonPressed: function buttonPressed() {
  12718. A.addClass(p.pressed);
  12719. } }, remove: { loading: function loading() {
  12720. k.removeClass(p.loading);
  12721. }, focus: function focus() {
  12722. k.removeClass(p.focus);
  12723. }, buttonPressed: function buttonPressed() {
  12724. A.removeClass(p.pressed);
  12725. } }, query: function query(t) {
  12726. t = e.isFunction(t) ? t : function () {};var n = m.get.value(),
  12727. 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();
  12728. }, search: { local: function local(e) {
  12729. var t,
  12730. 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 });
  12731. }, remote: function remote(t, n) {
  12732. n = e.isFunction(n) ? n : function () {}, k.api("is loading") && k.api("abort"), m.setup.api(t, n), k.api("query");
  12733. }, object: function object(t, n, o) {
  12734. var a = [],
  12735. r = [],
  12736. s = [],
  12737. l = t.toString().replace(v.escape, "\\$&"),
  12738. c = new RegExp(v.beginsWith + l, "i"),
  12739. u = function u(t, n) {
  12740. var i = -1 == e.inArray(n, a),
  12741. o = -1 == e.inArray(n, s),
  12742. l = -1 == e.inArray(n, r);i && o && l && t.push(n);
  12743. };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) {
  12744. e.each(n, function (e, n) {
  12745. "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));
  12746. });
  12747. }), e.merge(r, s), e.merge(a, r), a);
  12748. } }, exactSearch: function exactSearch(e, t) {
  12749. return e = e.toLowerCase(), (t = t.toLowerCase()).indexOf(e) > -1;
  12750. }, fuzzySearch: function fuzzySearch(e, t) {
  12751. var n = t.length,
  12752. 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++) {
  12753. for (var r = e.charCodeAt(o); a < n;) {
  12754. if (t.charCodeAt(a++) === r) continue e;
  12755. }return !1;
  12756. }return !0;
  12757. }, parse: { response: function response(e, t) {
  12758. 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]));
  12759. } }, cancel: { query: function query() {
  12760. m.can.useAPI() && k.api("abort");
  12761. } }, has: { minimumCharacters: function minimumCharacters() {
  12762. return m.get.value().length >= g.minCharacters;
  12763. }, results: function results() {
  12764. return 0 !== R.length && "" != R.html();
  12765. } }, clear: { cache: function cache(e) {
  12766. 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));
  12767. } }, read: { cache: function cache(e) {
  12768. 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]);
  12769. } }, create: { categoryResults: function categoryResults(t) {
  12770. var n = {};return e.each(t, function (e, t) {
  12771. 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));
  12772. }), n;
  12773. }, id: function id(e, t) {
  12774. var n,
  12775. 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;
  12776. }, results: function results() {
  12777. 0 === R.length && (R = e("<div />").addClass(p.results).appendTo(k));
  12778. } }, inject: { result: function result(e, t, n) {
  12779. 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);
  12780. }, id: function id(t) {
  12781. m.debug("Injecting unique ids into results");var n = 0,
  12782. o = 0;return "category" === g.type ? e.each(t, function (t, a) {
  12783. o = 0, e.each(a.results, function (e, t) {
  12784. var r = a.results[e];r.id === i && (r.id = m.create.id(o, n)), m.inject.result(r, o, n), o++;
  12785. }), n++;
  12786. }) : e.each(t, function (e, n) {
  12787. var a = t[e];a.id === i && (a.id = m.create.id(o)), m.inject.result(a, o), o++;
  12788. }), t;
  12789. } }, save: { results: function results(e) {
  12790. m.verbose("Saving current search results to metadata", e), k.data(h.results, e);
  12791. } }, write: { cache: function cache(e, t) {
  12792. 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));
  12793. } }, addResults: function addResults(t) {
  12794. 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 () {
  12795. R.empty();
  12796. });
  12797. }, showResults: function showResults(t) {
  12798. 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() {
  12799. t();
  12800. }, queue: !0 })) : (m.debug("Showing results with javascript"), R.stop().fadeIn(g.duration, g.easing)), g.onResultsOpen.call(R));
  12801. }, hideResults: function hideResults(t) {
  12802. 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() {
  12803. t();
  12804. }, queue: !0 })) : (m.debug("Hiding results with javascript"), R.stop().fadeOut(g.duration, g.easing)), g.onResultsClose.call(R));
  12805. }, generateResults: function generateResults(t) {
  12806. m.debug("Generating html from response", t);var n = g.templates[g.type],
  12807. i = e.isPlainObject(t[b.results]) && !e.isEmptyObject(t[b.results]),
  12808. o = e.isArray(t[b.results]) && t[b.results].length > 0,
  12809. 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;
  12810. }, displayMessage: function displayMessage(e, t) {
  12811. return t = t || "standard", m.debug("Displaying message", e, t), m.addResults(g.templates.message(e, t)), g.templates.message(e, t);
  12812. }, setting: function setting(t, n) {
  12813. if (e.isPlainObject(t)) e.extend(!0, g, t);else {
  12814. if (n === i) return g[t];g[t] = n;
  12815. }
  12816. }, internal: function internal(t, n) {
  12817. if (e.isPlainObject(t)) e.extend(!0, m, t);else {
  12818. if (n === i) return m[t];m[t] = n;
  12819. }
  12820. }, debug: function debug() {
  12821. !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)));
  12822. }, verbose: function verbose() {
  12823. !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)));
  12824. }, error: function error() {
  12825. g.silent || (m.error = Function.prototype.bind.call(console.error, console, g.name + ":"), m.error.apply(console, arguments));
  12826. }, performance: { log: function log(e) {
  12827. 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);
  12828. }, display: function display() {
  12829. var t = g.name + ":",
  12830. n = 0;l = !1, clearTimeout(m.performance.timer), e.each(c, function (e, t) {
  12831. n += t["Execution Time"];
  12832. }), 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) {
  12833. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  12834. }), console.groupEnd()), c = [];
  12835. } }, invoke: function invoke(t, n, o) {
  12836. var r,
  12837. s,
  12838. l,
  12839. 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) {
  12840. 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 {
  12841. 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];
  12842. }
  12843. })), 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;
  12844. } }, d ? (F === i && m.initialize(), m.invoke(u)) : (F !== i && F.invoke("destroy"), m.initialize());
  12845. }), a !== i ? a : this;
  12846. }, 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) {
  12847. var t = { "&": "&amp;", "<": "&lt;", ">": "&gt;", '"': "&quot;", "'": "&#x27;", "`": "&#x60;" };return (/[&<>"'`]/.test(e) ? e.replace(/[&<>"'`]/g, function (e) {
  12848. return t[e];
  12849. }) : e
  12850. );
  12851. }, message: function message(e, t) {
  12852. 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;
  12853. }, category: function category(t, n) {
  12854. var o = "";e.fn.search.settings.templates.escape;return t[n.categoryResults] !== i && (e.each(t[n.categoryResults], function (t, a) {
  12855. 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) {
  12856. 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>";
  12857. }), o += "</div>", o += "</div>");
  12858. }), t[n.action] && (o += '<a href="' + t[n.action][n.actionURL] + '" class="action">' + t[n.action][n.actionText] + "</a>"), o);
  12859. }, standard: function standard(t, n) {
  12860. var o = "";return t[n.results] !== i && (e.each(t[n.results], function (e, t) {
  12861. 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>";
  12862. }), t[n.action] && (o += '<a href="' + t[n.action][n.actionURL] + '" class="action">' + t[n.action][n.actionText] + "</a>"), o);
  12863. } } };
  12864. }(jQuery, window, document), function (e, t, n, i) {
  12865. "use strict";
  12866. t = void 0 !== t && t.Math == Math ? t : "undefined" != typeof self && self.Math == Math ? self : Function("return this")(), e.fn.shape = function (o) {
  12867. var a,
  12868. r = e(this),
  12869. s = (e("body"), new Date().getTime()),
  12870. l = [],
  12871. c = arguments[0],
  12872. u = "string" == typeof c,
  12873. d = [].slice.call(arguments, 1),
  12874. f = t.requestAnimationFrame || t.mozRequestAnimationFrame || t.webkitRequestAnimationFrame || t.msRequestAnimationFrame || function (e) {
  12875. setTimeout(e, 0);
  12876. };return r.each(function () {
  12877. var t,
  12878. m,
  12879. g,
  12880. p = r.selector || "",
  12881. h = e.isPlainObject(o) ? e.extend(!0, {}, e.fn.shape.settings, o) : e.extend({}, e.fn.shape.settings),
  12882. v = h.namespace,
  12883. b = h.selector,
  12884. y = h.error,
  12885. x = h.className,
  12886. C = "." + v,
  12887. w = "module-" + v,
  12888. S = e(this),
  12889. k = S.find(b.sides),
  12890. T = S.find(b.side),
  12891. A = !1,
  12892. R = this,
  12893. P = S.data(w);g = { initialize: function initialize() {
  12894. g.verbose("Initializing module for", R), g.set.defaultSide(), g.instantiate();
  12895. }, instantiate: function instantiate() {
  12896. g.verbose("Storing instance of module", g), P = g, S.data(w, P);
  12897. }, destroy: function destroy() {
  12898. g.verbose("Destroying previous module for", R), S.removeData(w).off(C);
  12899. }, refresh: function refresh() {
  12900. g.verbose("Refreshing selector cache for", R), S = e(R), k = e(this).find(b.shape), T = e(this).find(b.side);
  12901. }, repaint: function repaint() {
  12902. g.verbose("Forcing repaint event");(k[0] || n.createElement("div")).offsetWidth;
  12903. }, animate: function animate(e, n) {
  12904. g.verbose("Animating box with properties", e), n = n || function (e) {
  12905. g.verbose("Executing animation callback"), e !== i && e.stopPropagation(), g.reset(), g.set.active();
  12906. }, 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 () {
  12907. S.addClass(x.animating), t.addClass(x.hidden);
  12908. })) : n();
  12909. }, queue: function queue(e) {
  12910. g.debug("Queueing animation of", e), k.one(g.get.transitionEvent(), function () {
  12911. g.debug("Executing queued animation"), setTimeout(function () {
  12912. S.shape(e);
  12913. }, 0);
  12914. });
  12915. }, reset: function reset() {
  12916. 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");
  12917. }, is: { complete: function complete() {
  12918. return T.filter("." + x.active)[0] == m[0];
  12919. }, animating: function animating() {
  12920. return S.hasClass(x.animating);
  12921. } }, set: { defaultSide: function defaultSide() {
  12922. 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);
  12923. }, duration: function duration(e) {
  12924. 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 });
  12925. }, currentStageSize: function currentStageSize() {
  12926. var e = S.find("." + h.className.active),
  12927. t = e.outerWidth(!0),
  12928. n = e.outerHeight(!0);S.css({ width: t, height: n });
  12929. }, stageSize: function stageSize() {
  12930. var e = S.clone().addClass(x.loading),
  12931. t = e.find("." + h.className.active),
  12932. n = A ? e.find(b.side).eq(A) : t.next(b.side).length > 0 ? t.next(b.side) : e.find(b.side).first(),
  12933. i = "next" == h.width ? n.outerWidth(!0) : "initial" == h.width ? S.width() : h.width,
  12934. 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));
  12935. }, nextSide: function nextSide(e) {
  12936. 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);
  12937. }, active: function active() {
  12938. g.verbose("Setting new side to active", m), T.removeClass(x.active), m.addClass(x.active), h.onChange.call(m[0]), g.set.defaultSide();
  12939. } }, flip: { up: function up() {
  12940. if (!g.is.complete() || g.is.animating() || h.allowRepeats) {
  12941. if (g.is.animating()) g.queue("flip up");else {
  12942. g.debug("Flipping up", m);var e = g.get.transform.up();g.set.stageSize(), g.stage.above(), g.animate(e);
  12943. }
  12944. } else g.debug("Side already visible", m);
  12945. }, down: function down() {
  12946. if (!g.is.complete() || g.is.animating() || h.allowRepeats) {
  12947. if (g.is.animating()) g.queue("flip down");else {
  12948. g.debug("Flipping down", m);var e = g.get.transform.down();g.set.stageSize(), g.stage.below(), g.animate(e);
  12949. }
  12950. } else g.debug("Side already visible", m);
  12951. }, left: function left() {
  12952. if (!g.is.complete() || g.is.animating() || h.allowRepeats) {
  12953. if (g.is.animating()) g.queue("flip left");else {
  12954. g.debug("Flipping left", m);var e = g.get.transform.left();g.set.stageSize(), g.stage.left(), g.animate(e);
  12955. }
  12956. } else g.debug("Side already visible", m);
  12957. }, right: function right() {
  12958. if (!g.is.complete() || g.is.animating() || h.allowRepeats) {
  12959. if (g.is.animating()) g.queue("flip right");else {
  12960. g.debug("Flipping right", m);var e = g.get.transform.right();g.set.stageSize(), g.stage.right(), g.animate(e);
  12961. }
  12962. } else g.debug("Side already visible", m);
  12963. }, over: function over() {
  12964. !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);
  12965. }, back: function back() {
  12966. !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);
  12967. } }, get: { transform: { up: function up() {
  12968. return { transform: "translateY(" + -(t.outerHeight(!0) - m.outerHeight(!0)) / 2 + "px) translateZ(" + -t.outerHeight(!0) / 2 + "px) rotateX(-90deg)" };
  12969. }, down: function down() {
  12970. return { transform: "translateY(" + -(t.outerHeight(!0) - m.outerHeight(!0)) / 2 + "px) translateZ(" + -t.outerHeight(!0) / 2 + "px) rotateX(90deg)" };
  12971. }, left: function left() {
  12972. return { transform: "translateX(" + -(t.outerWidth(!0) - m.outerWidth(!0)) / 2 + "px) translateZ(" + -t.outerWidth(!0) / 2 + "px) rotateY(90deg)" };
  12973. }, right: function right() {
  12974. return { transform: "translateX(" + -(t.outerWidth(!0) - m.outerWidth(!0)) / 2 + "px) translateZ(" + -t.outerWidth(!0) / 2 + "px) rotateY(-90deg)" };
  12975. }, over: function over() {
  12976. return { transform: "translateX(" + -(t.outerWidth(!0) - m.outerWidth(!0)) / 2 + "px) rotateY(180deg)" };
  12977. }, back: function back() {
  12978. return { transform: "translateX(" + -(t.outerWidth(!0) - m.outerWidth(!0)) / 2 + "px) rotateY(-180deg)" };
  12979. } }, transitionEvent: function transitionEvent() {
  12980. var e,
  12981. t = n.createElement("element"),
  12982. o = { transition: "transitionend", OTransition: "oTransitionEnd", MozTransition: "transitionend", WebkitTransition: "webkitTransitionEnd" };for (e in o) {
  12983. if (t.style[e] !== i) return o[e];
  12984. }
  12985. }, nextSide: function nextSide() {
  12986. return t.next(b.side).length > 0 ? t.next(b.side) : S.find(b.side).first();
  12987. } }, stage: { above: function above() {
  12988. 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)" });
  12989. }, below: function below() {
  12990. 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)" });
  12991. }, left: function left() {
  12992. var e = t.outerWidth(!0),
  12993. n = m.outerWidth(!0),
  12994. 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)" });
  12995. }, right: function right() {
  12996. var e = t.outerWidth(!0),
  12997. n = m.outerWidth(!0),
  12998. 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)" });
  12999. }, behind: function behind() {
  13000. var e = t.outerWidth(!0),
  13001. n = m.outerWidth(!0),
  13002. 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)" });
  13003. } }, setting: function setting(t, n) {
  13004. if (g.debug("Changing setting", t, n), e.isPlainObject(t)) e.extend(!0, h, t);else {
  13005. if (n === i) return h[t];e.isPlainObject(h[t]) ? e.extend(!0, h[t], n) : h[t] = n;
  13006. }
  13007. }, internal: function internal(t, n) {
  13008. if (e.isPlainObject(t)) e.extend(!0, g, t);else {
  13009. if (n === i) return g[t];g[t] = n;
  13010. }
  13011. }, debug: function debug() {
  13012. !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)));
  13013. }, verbose: function verbose() {
  13014. !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)));
  13015. }, error: function error() {
  13016. h.silent || (g.error = Function.prototype.bind.call(console.error, console, h.name + ":"), g.error.apply(console, arguments));
  13017. }, performance: { log: function log(e) {
  13018. 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);
  13019. }, display: function display() {
  13020. var t = h.name + ":",
  13021. n = 0;s = !1, clearTimeout(g.performance.timer), e.each(l, function (e, t) {
  13022. n += t["Execution Time"];
  13023. }), 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) {
  13024. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  13025. }), console.groupEnd()), l = [];
  13026. } }, invoke: function invoke(t, n, o) {
  13027. var r,
  13028. s,
  13029. l,
  13030. 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) {
  13031. 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 {
  13032. 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];
  13033. }
  13034. })), 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;
  13035. } }, u ? (P === i && g.initialize(), g.invoke(c)) : (P !== i && P.invoke("destroy"), g.initialize());
  13036. }), a !== i ? a : this;
  13037. }, 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" } };
  13038. }(jQuery, window, document), function (e, t, n, i) {
  13039. "use strict";
  13040. t = void 0 !== t && t.Math == Math ? t : "undefined" != typeof self && self.Math == Math ? self : Function("return this")(), e.fn.sidebar = function (o) {
  13041. var a,
  13042. r = e(this),
  13043. s = e(t),
  13044. l = e(n),
  13045. c = e("html"),
  13046. u = e("head"),
  13047. d = r.selector || "",
  13048. f = new Date().getTime(),
  13049. m = [],
  13050. g = arguments[0],
  13051. p = "string" == typeof g,
  13052. h = [].slice.call(arguments, 1),
  13053. v = t.requestAnimationFrame || t.mozRequestAnimationFrame || t.webkitRequestAnimationFrame || t.msRequestAnimationFrame || function (e) {
  13054. setTimeout(e, 0);
  13055. };return r.each(function () {
  13056. var r,
  13057. b,
  13058. y,
  13059. x,
  13060. C,
  13061. w,
  13062. S = e.isPlainObject(o) ? e.extend(!0, {}, e.fn.sidebar.settings, o) : e.extend({}, e.fn.sidebar.settings),
  13063. k = S.selector,
  13064. T = S.className,
  13065. A = S.namespace,
  13066. R = S.regExp,
  13067. P = S.error,
  13068. E = "." + A,
  13069. F = "module-" + A,
  13070. O = e(this),
  13071. D = e(S.context),
  13072. q = O.children(k.sidebar),
  13073. j = (D.children(k.fixed), D.children(k.pusher)),
  13074. z = this,
  13075. I = O.data(F);w = { initialize: function initialize() {
  13076. w.debug("Initializing sidebar", o), w.create.id(), C = w.get.transitionEvent(), S.delaySetup ? v(w.setup.layout) : w.setup.layout(), v(function () {
  13077. w.setup.cache();
  13078. }), w.instantiate();
  13079. }, instantiate: function instantiate() {
  13080. w.verbose("Storing instance of module", w), I = w, O.data(F, w);
  13081. }, create: { id: function id() {
  13082. y = (Math.random().toString(16) + "000000000").substr(2, 8), b = "." + y, w.verbose("Creating unique id for element", y);
  13083. } }, destroy: function destroy() {
  13084. 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);
  13085. }, event: { clickaway: function clickaway(e) {
  13086. var t = j.find(e.target).length > 0 || j.is(e.target),
  13087. 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());
  13088. }, touch: function touch(e) {}, containScroll: function containScroll(e) {
  13089. z.scrollTop <= 0 && (z.scrollTop = 1), z.scrollTop + z.offsetHeight >= z.scrollHeight && (z.scrollTop = z.scrollHeight - z.offsetHeight - 1);
  13090. }, scroll: function scroll(t) {
  13091. 0 === e(t.target).closest(k.sidebar).length && t.preventDefault();
  13092. } }, bind: { clickaway: function clickaway() {
  13093. w.verbose("Adding clickaway events to context", D), S.closable && D.on("click" + b, w.event.clickaway).on("touchend" + b, w.event.clickaway);
  13094. }, scrollLock: function scrollLock() {
  13095. 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);
  13096. } }, unbind: { clickaway: function clickaway() {
  13097. w.verbose("Removing clickaway events from context", D), D.off(b);
  13098. }, scrollLock: function scrollLock() {
  13099. w.verbose("Removing scroll lock from page"), l.off(b), s.off(b), O.off("scroll" + E);
  13100. } }, add: { inlineCSS: function inlineCSS() {
  13101. var t,
  13102. n = w.cache.width || O.outerWidth(),
  13103. i = w.cache.height || O.outerHeight(),
  13104. o = w.is.rtl(),
  13105. a = w.get.direction(),
  13106. 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);
  13107. } }, refresh: function refresh() {
  13108. 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();
  13109. }, refreshSidebars: function refreshSidebars() {
  13110. w.verbose("Refreshing other sidebars"), q = D.children(k.sidebar);
  13111. }, repaint: function repaint() {
  13112. w.verbose("Forcing repaint event"), z.style.display = "none";z.offsetHeight;z.scrollTop = z.scrollTop, z.style.display = "";
  13113. }, setup: { cache: function cache() {
  13114. w.cache = { width: O.outerWidth(), height: O.outerHeight(), rtl: "rtl" == O.css("direction") };
  13115. }, layout: function layout() {
  13116. 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();
  13117. } }, attachEvents: function attachEvents(t, n) {
  13118. 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);
  13119. }, show: function show(t) {
  13120. if (t = e.isFunction(t) ? t : function () {}, w.is.hidden()) {
  13121. 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) {
  13122. if ("overlay" != S.transition) return void w.hideOthers(w.show);w.hideOthers();
  13123. } else S.transition = "overlay";w.pushPage(function () {
  13124. t.call(z), S.onShow.call(z);
  13125. }), S.onChange.call(z), S.onVisible.call(z);
  13126. } else w.debug("Sidebar is already visible");
  13127. }, hide: function hide(t) {
  13128. t = e.isFunction(t) ? t : function () {}, (w.is.visible() || w.is.animating()) && (w.debug("Hiding sidebar", t), w.refreshSidebars(), w.pullPage(function () {
  13129. t.call(z), S.onHidden.call(z);
  13130. }), S.onChange.call(z), S.onHide.call(z));
  13131. }, othersAnimating: function othersAnimating() {
  13132. return q.not(O).filter("." + T.animating).length > 0;
  13133. }, othersVisible: function othersVisible() {
  13134. return q.not(O).filter("." + T.visible).length > 0;
  13135. }, othersActive: function othersActive() {
  13136. return w.othersVisible() || w.othersAnimating();
  13137. }, hideOthers: function hideOthers(e) {
  13138. var t = q.not(O).filter("." + T.visible),
  13139. n = t.length,
  13140. i = 0;e = e || function () {}, t.sidebar("hide", function () {
  13141. ++i == n && e();
  13142. });
  13143. }, toggle: function toggle() {
  13144. w.verbose("Determining toggled direction"), w.is.hidden() ? w.show() : w.hide();
  13145. }, pushPage: function pushPage(t) {
  13146. var n,
  13147. i,
  13148. _o,
  13149. a = w.get.transition(),
  13150. 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() {
  13151. w.bind.clickaway(), w.add.inlineCSS(), w.set.animating(), w.set.visible();
  13152. }, i = function i() {
  13153. w.set.dimmed();
  13154. }, _o = function o(e) {
  13155. e.target == r[0] && (r.off(C + b, _o), w.remove.animating(), w.bind.scrollLock(), t.call(z));
  13156. }, r.off(C + b), r.on(C + b, _o), v(n), S.dimPage && !w.othersVisible() && v(i);
  13157. }, pullPage: function pullPage(t) {
  13158. var n,
  13159. _i,
  13160. o = w.get.transition(),
  13161. 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() {
  13162. w.set.transition(o), w.set.animating(), w.remove.visible(), S.dimPage && !w.othersVisible() && j.removeClass(T.dimmed);
  13163. }, _i = function i(e) {
  13164. 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));
  13165. }, a.off(C + b), a.on(C + b, _i), v(n);
  13166. }, scrollToTop: function scrollToTop() {
  13167. w.verbose("Scrolling to top of page to avoid animation issues"), x = e(t).scrollTop(), O.scrollTop(0), t.scrollTo(0, 0);
  13168. }, scrollBack: function scrollBack() {
  13169. w.verbose("Scrolling back to original page position"), t.scrollTo(0, x);
  13170. }, clear: { cache: function cache() {
  13171. w.verbose("Clearing cached dimensions"), w.cache = {};
  13172. } }, set: { ios: function ios() {
  13173. c.addClass(T.ios);
  13174. }, pushed: function pushed() {
  13175. D.addClass(T.pushed);
  13176. }, pushable: function pushable() {
  13177. D.addClass(T.pushable);
  13178. }, dimmed: function dimmed() {
  13179. j.addClass(T.dimmed);
  13180. }, active: function active() {
  13181. O.addClass(T.active);
  13182. }, animating: function animating() {
  13183. O.addClass(T.animating);
  13184. }, transition: function transition(e) {
  13185. e = e || w.get.transition(), O.addClass(e);
  13186. }, direction: function direction(e) {
  13187. e = e || w.get.direction(), O.addClass(T[e]);
  13188. }, visible: function visible() {
  13189. O.addClass(T.visible);
  13190. }, overlay: function overlay() {
  13191. O.addClass(T.overlay);
  13192. } }, remove: { inlineCSS: function inlineCSS() {
  13193. w.debug("Removing inline css styles", r), r && r.length > 0 && r.remove();
  13194. }, ios: function ios() {
  13195. c.removeClass(T.ios);
  13196. }, pushed: function pushed() {
  13197. D.removeClass(T.pushed);
  13198. }, pushable: function pushable() {
  13199. D.removeClass(T.pushable);
  13200. }, active: function active() {
  13201. O.removeClass(T.active);
  13202. }, animating: function animating() {
  13203. O.removeClass(T.animating);
  13204. }, transition: function transition(e) {
  13205. e = e || w.get.transition(), O.removeClass(e);
  13206. }, direction: function direction(e) {
  13207. e = e || w.get.direction(), O.removeClass(T[e]);
  13208. }, visible: function visible() {
  13209. O.removeClass(T.visible);
  13210. }, overlay: function overlay() {
  13211. O.removeClass(T.overlay);
  13212. } }, get: { direction: function direction() {
  13213. return O.hasClass(T.top) ? T.top : O.hasClass(T.right) ? T.right : O.hasClass(T.bottom) ? T.bottom : T.left;
  13214. }, transition: function transition() {
  13215. var e,
  13216. 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;
  13217. }, transitionEvent: function transitionEvent() {
  13218. var e,
  13219. t = n.createElement("element"),
  13220. o = { transition: "transitionend", OTransition: "oTransitionEnd", MozTransition: "transitionend", WebkitTransition: "webkitTransitionEnd" };for (e in o) {
  13221. if (t.style[e] !== i) return o[e];
  13222. }
  13223. } }, is: { ie: function ie() {
  13224. return !t.ActiveXObject && "ActiveXObject" in t || "ActiveXObject" in t;
  13225. }, ios: function ios() {
  13226. var e = navigator.userAgent,
  13227. t = e.match(R.ios),
  13228. n = e.match(R.mobileChrome);return !(!t || n) && (w.verbose("Browser was found to be iOS", e), !0);
  13229. }, mobile: function mobile() {
  13230. 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);
  13231. }, hidden: function hidden() {
  13232. return !w.is.visible();
  13233. }, visible: function visible() {
  13234. return O.hasClass(T.visible);
  13235. }, open: function open() {
  13236. return w.is.visible();
  13237. }, closed: function closed() {
  13238. return w.is.hidden();
  13239. }, vertical: function vertical() {
  13240. return O.hasClass(T.top);
  13241. }, animating: function animating() {
  13242. return D.hasClass(T.animating);
  13243. }, rtl: function rtl() {
  13244. return w.cache.rtl === i && (w.cache.rtl = "rtl" == O.css("direction")), w.cache.rtl;
  13245. } }, setting: function setting(t, n) {
  13246. if (w.debug("Changing setting", t, n), e.isPlainObject(t)) e.extend(!0, S, t);else {
  13247. if (n === i) return S[t];e.isPlainObject(S[t]) ? e.extend(!0, S[t], n) : S[t] = n;
  13248. }
  13249. }, internal: function internal(t, n) {
  13250. if (e.isPlainObject(t)) e.extend(!0, w, t);else {
  13251. if (n === i) return w[t];w[t] = n;
  13252. }
  13253. }, debug: function debug() {
  13254. !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)));
  13255. }, verbose: function verbose() {
  13256. !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)));
  13257. }, error: function error() {
  13258. S.silent || (w.error = Function.prototype.bind.call(console.error, console, S.name + ":"), w.error.apply(console, arguments));
  13259. }, performance: { log: function log(e) {
  13260. 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);
  13261. }, display: function display() {
  13262. var t = S.name + ":",
  13263. n = 0;f = !1, clearTimeout(w.performance.timer), e.each(m, function (e, t) {
  13264. n += t["Execution Time"];
  13265. }), 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) {
  13266. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  13267. }), console.groupEnd()), m = [];
  13268. } }, invoke: function invoke(t, n, o) {
  13269. var r,
  13270. s,
  13271. l,
  13272. 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) {
  13273. 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 {
  13274. 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];
  13275. }
  13276. })), 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;
  13277. } }, p ? (I === i && w.initialize(), w.invoke(g)) : (I !== i && w.invoke("destroy"), w.initialize());
  13278. }), a !== i ? a : this;
  13279. }, 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" } };
  13280. }(jQuery, window, document), function (e, t, n, i) {
  13281. "use strict";
  13282. t = void 0 !== t && t.Math == Math ? t : "undefined" != typeof self && self.Math == Math ? self : Function("return this")(), e.fn.sticky = function (o) {
  13283. var a,
  13284. r = e(this),
  13285. s = r.selector || "",
  13286. l = new Date().getTime(),
  13287. c = [],
  13288. u = arguments[0],
  13289. d = "string" == typeof u,
  13290. f = [].slice.call(arguments, 1);return r.each(function () {
  13291. var r,
  13292. m,
  13293. g,
  13294. p,
  13295. h,
  13296. v = e.isPlainObject(o) ? e.extend(!0, {}, e.fn.sticky.settings, o) : e.extend({}, e.fn.sticky.settings),
  13297. b = v.className,
  13298. y = v.namespace,
  13299. x = v.error,
  13300. C = "." + y,
  13301. w = "module-" + y,
  13302. S = e(this),
  13303. k = e(t),
  13304. T = e(v.scrollContext),
  13305. A = (S.selector, S.data(w)),
  13306. R = t.requestAnimationFrame || t.mozRequestAnimationFrame || t.webkitRequestAnimationFrame || t.msRequestAnimationFrame || function (e) {
  13307. setTimeout(e, 0);
  13308. },
  13309. P = this;h = { initialize: function initialize() {
  13310. h.determineContainer(), h.determineContext(), h.verbose("Initializing sticky", v, r), h.save.positions(), h.checkErrors(), h.bind.events(), v.observeChanges && h.observeChanges(), h.instantiate();
  13311. }, instantiate: function instantiate() {
  13312. h.verbose("Storing instance of module", h), A = h, S.data(w, h);
  13313. }, destroy: function destroy() {
  13314. 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);
  13315. }, observeChanges: function observeChanges() {
  13316. "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));
  13317. }, determineContainer: function determineContainer() {
  13318. r = v.container ? e(v.container) : S.offsetParent();
  13319. }, determineContext: function determineContext() {
  13320. 0 !== (m = v.context ? e(v.context) : r).length || h.error(x.invalidContext, v.context, S);
  13321. }, checkErrors: function checkErrors() {
  13322. 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);
  13323. }, bind: { events: function events() {
  13324. 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);
  13325. } }, event: { changed: function changed(e) {
  13326. clearTimeout(h.timer), h.timer = setTimeout(function () {
  13327. h.verbose("DOM tree modified, updating sticky menu", e), h.refresh();
  13328. }, 100);
  13329. }, documentChanged: function documentChanged(t) {
  13330. [].forEach.call(t, function (t) {
  13331. t.removedNodes && [].forEach.call(t.removedNodes, function (t) {
  13332. (t == P || e(t).find(P).length > 0) && (h.debug("Element removed from DOM, tearing down events"), h.destroy());
  13333. });
  13334. });
  13335. }, load: function load() {
  13336. h.verbose("Page contents finished loading"), R(h.refresh);
  13337. }, resize: function resize() {
  13338. h.verbose("Window resized"), R(h.refresh);
  13339. }, scroll: function scroll() {
  13340. R(function () {
  13341. T.triggerHandler("scrollchange" + C, T.scrollTop());
  13342. });
  13343. }, scrollchange: function scrollchange(e, t) {
  13344. h.stick(t), v.onScroll.call(P);
  13345. } }, refresh: function refresh(e) {
  13346. h.reset(), v.context || h.determineContext(), e && h.determineContainer(), h.save.positions(), h.stick(), v.onReposition.call(P);
  13347. }, supports: { sticky: function sticky() {
  13348. var t = e("<div/>");t[0];return t.addClass(b.supported), t.css("position").match("sticky");
  13349. } }, save: { lastScroll: function lastScroll(e) {
  13350. h.lastScroll = e;
  13351. }, elementScroll: function elementScroll(e) {
  13352. h.elementScroll = e;
  13353. }, positions: function positions() {
  13354. var e = { height: T.height() },
  13355. 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() },
  13356. 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);
  13357. } }, get: { direction: function direction(e) {
  13358. var t = "down";return e = e || T.scrollTop(), h.lastScroll !== i && (h.lastScroll < e ? t = "down" : h.lastScroll > e && (t = "up")), t;
  13359. }, scrollChange: function scrollChange(e) {
  13360. return e = e || T.scrollTop(), h.lastScroll ? e - h.lastScroll : 0;
  13361. }, currentElementScroll: function currentElementScroll() {
  13362. return h.elementScroll ? h.elementScroll : h.is.top() ? Math.abs(parseInt(S.css("top"), 10)) || 0 : Math.abs(parseInt(S.css("bottom"), 10)) || 0;
  13363. }, elementScroll: function elementScroll(e) {
  13364. e = e || T.scrollTop();var t = h.cache.element,
  13365. n = h.cache.scrollContext,
  13366. i = h.get.scrollChange(e),
  13367. o = t.height - n.height + v.offset,
  13368. a = h.get.currentElementScroll(),
  13369. r = a + i;return a = h.cache.fits || r < 0 ? 0 : r > o ? o : r;
  13370. } }, remove: { lastScroll: function lastScroll() {
  13371. delete h.lastScroll;
  13372. }, elementScroll: function elementScroll(e) {
  13373. delete h.elementScroll;
  13374. }, minimumSize: function minimumSize() {
  13375. r.css("min-height", "");
  13376. }, offset: function offset() {
  13377. S.css("margin-top", "");
  13378. } }, set: { offset: function offset() {
  13379. h.verbose("Setting offset on element", v.offset), S.css("margin-top", v.offset);
  13380. }, containerSize: function containerSize() {
  13381. 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 }));
  13382. }, minimumSize: function minimumSize() {
  13383. var e = h.cache.element;r.css("min-height", e.height);
  13384. }, scroll: function scroll(e) {
  13385. 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));
  13386. }, size: function size() {
  13387. 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"));
  13388. } }, is: { standardScroll: function standardScroll() {
  13389. return T[0] == t;
  13390. }, top: function top() {
  13391. return S.hasClass(b.top);
  13392. }, bottom: function bottom() {
  13393. return S.hasClass(b.bottom);
  13394. }, initialPosition: function initialPosition() {
  13395. return !h.is.fixed() && !h.is.bound();
  13396. }, hidden: function hidden() {
  13397. return !S.is(":visible");
  13398. }, bound: function bound() {
  13399. return S.hasClass(b.bound);
  13400. }, fixed: function fixed() {
  13401. return S.hasClass(b.fixed);
  13402. } }, stick: function stick(e) {
  13403. var t = e || T.scrollTop(),
  13404. n = h.cache,
  13405. i = n.fits,
  13406. o = n.sameHeight,
  13407. a = n.element,
  13408. r = n.scrollContext,
  13409. s = n.context,
  13410. l = h.is.bottom() && v.pushing ? v.bottomOffset : v.offset,
  13411. c = (e = { top: t + l, bottom: t + l + r.height }, h.get.direction(e.top), i ? 0 : h.get.elementScroll(e.top)),
  13412. 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())));
  13413. }, bindTop: function bindTop() {
  13414. 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);
  13415. }, bindBottom: function bindBottom() {
  13416. 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);
  13417. }, setInitialPosition: function setInitialPosition() {
  13418. h.debug("Returning to initial position"), h.unfix(), h.unbind();
  13419. }, fixTop: function fixTop() {
  13420. 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);
  13421. }, fixBottom: function fixBottom() {
  13422. 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);
  13423. }, unbind: function unbind() {
  13424. h.is.bound() && (h.debug("Removing container bound position on element"), h.remove.offset(), S.removeClass(b.bound).removeClass(b.top).removeClass(b.bottom));
  13425. }, unfix: function unfix() {
  13426. 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));
  13427. }, reset: function reset() {
  13428. h.debug("Resetting elements position"), h.unbind(), h.unfix(), h.resetCSS(), h.remove.offset(), h.remove.lastScroll();
  13429. }, resetCSS: function resetCSS() {
  13430. S.css({ width: "", height: "" }), r.css({ height: "" });
  13431. }, setting: function setting(t, n) {
  13432. if (e.isPlainObject(t)) e.extend(!0, v, t);else {
  13433. if (n === i) return v[t];v[t] = n;
  13434. }
  13435. }, internal: function internal(t, n) {
  13436. if (e.isPlainObject(t)) e.extend(!0, h, t);else {
  13437. if (n === i) return h[t];h[t] = n;
  13438. }
  13439. }, debug: function debug() {
  13440. !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)));
  13441. }, verbose: function verbose() {
  13442. !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)));
  13443. }, error: function error() {
  13444. v.silent || (h.error = Function.prototype.bind.call(console.error, console, v.name + ":"), h.error.apply(console, arguments));
  13445. }, performance: { log: function log(e) {
  13446. 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);
  13447. }, display: function display() {
  13448. var t = v.name + ":",
  13449. n = 0;l = !1, clearTimeout(h.performance.timer), e.each(c, function (e, t) {
  13450. n += t["Execution Time"];
  13451. }), 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) {
  13452. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  13453. }), console.groupEnd()), c = [];
  13454. } }, invoke: function invoke(t, n, o) {
  13455. var r,
  13456. s,
  13457. l,
  13458. 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) {
  13459. 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 {
  13460. 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];
  13461. }
  13462. })), 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;
  13463. } }, d ? (A === i && h.initialize(), h.invoke(u)) : (A !== i && A.invoke("destroy"), h.initialize());
  13464. }), a !== i ? a : this;
  13465. }, 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" } };
  13466. }(jQuery, window, document), function (e, t, n, i) {
  13467. "use strict";
  13468. t = void 0 !== t && t.Math == Math ? t : "undefined" != typeof self && self.Math == Math ? self : Function("return this")(), e.fn.tab = function (o) {
  13469. var a,
  13470. r = e.isFunction(this) ? e(t) : e(this),
  13471. s = r.selector || "",
  13472. l = new Date().getTime(),
  13473. c = [],
  13474. u = arguments[0],
  13475. d = "string" == typeof u,
  13476. f = [].slice.call(arguments, 1),
  13477. m = !1;return r.each(function () {
  13478. var g,
  13479. p,
  13480. h,
  13481. v,
  13482. b,
  13483. y,
  13484. x = e.isPlainObject(o) ? e.extend(!0, {}, e.fn.tab.settings, o) : e.extend({}, e.fn.tab.settings),
  13485. C = x.className,
  13486. w = x.metadata,
  13487. S = x.selector,
  13488. k = x.error,
  13489. T = "." + x.namespace,
  13490. A = "module-" + x.namespace,
  13491. R = e(this),
  13492. P = {},
  13493. E = !0,
  13494. F = 0,
  13495. O = this,
  13496. D = R.data(A);b = { initialize: function initialize() {
  13497. 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();
  13498. }, instantiate: function instantiate() {
  13499. b.verbose("Storing instance of module", b), D = b, R.data(A, b);
  13500. }, destroy: function destroy() {
  13501. b.debug("Destroying tabs", R), R.removeData(A).off(T);
  13502. }, bind: { events: function events() {
  13503. e.isWindow(O) || (b.debug("Attaching tab activation events to element", R), R.on("click" + T, b.event.click));
  13504. } }, determineTabs: function determineTabs() {
  13505. 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));
  13506. }, fix: { callbacks: function callbacks() {
  13507. 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));
  13508. } }, initializeHistory: function initializeHistory() {
  13509. if (b.debug("Initializing page state"), e.address === i) return b.error(k.state), !1;if ("state" == x.historyType) {
  13510. if (b.debug("Using HTML5 to manage state"), !1 === x.path) return b.error(k.path), !1;e.address.history(!0).state(x.path);
  13511. }e.address.bind("change", b.event.history.change);
  13512. }, event: { click: function click(t) {
  13513. 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");
  13514. }, history: { change: function change(t) {
  13515. var n = t.pathNames.join("/") || b.get.initialPath(),
  13516. 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);
  13517. } } }, refresh: function refresh() {
  13518. h && (b.debug("Refreshing tab", h), b.changeTab(h));
  13519. }, cache: { read: function read(e) {
  13520. return e !== i && P[e];
  13521. }, add: function add(e, t) {
  13522. e = e || h, b.debug("Adding cached content for", e), P[e] = t;
  13523. }, remove: function remove(e) {
  13524. e = e || h, b.debug("Removing cached content for", e), delete P[e];
  13525. } }, set: { auto: function auto() {
  13526. 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 };
  13527. }, loading: function loading(e) {
  13528. 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));
  13529. }, state: function state(t) {
  13530. e.address.value(t);
  13531. } }, changeTab: function changeTab(n) {
  13532. var i = t.history && t.history.pushState && x.ignoreFirstLoad && E,
  13533. o = x.auto || e.isPlainObject(x.apiSettings),
  13534. a = o && !i ? b.utilities.pathToArray(n) : b.get.defaultPathArray(n);n = b.utilities.arrayToPath(a), e.each(a, function (t, r) {
  13535. var s,
  13536. l,
  13537. c,
  13538. u,
  13539. d = a.slice(0, t + 1),
  13540. f = b.utilities.arrayToPath(d),
  13541. m = b.is.tab(f),
  13542. p = t + 1 == a.length,
  13543. S = b.get.tabElement(f);if (b.verbose("Looking for tab", r), m) {
  13544. 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);
  13545. } else {
  13546. 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 () {
  13547. b.scrollTo(s);
  13548. }, 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;
  13549. }
  13550. });
  13551. }, scrollTo: function scrollTo(t) {
  13552. 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));
  13553. }, update: { content: function content(t, n, o) {
  13554. var a = b.get.tabElement(t),
  13555. 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);
  13556. } }, fetch: { content: function content(t, n) {
  13557. var o,
  13558. a,
  13559. r = b.get.tabElement(t),
  13560. s = { dataType: "html", encodeParameters: !1, on: "now", cache: x.alwaysRefresh, headers: { "X-Remote": !0 }, onSuccess: function onSuccess(e) {
  13561. "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 () {
  13562. var e = r.children().clone(!0);e = e.not("script"), b.cache.add(n, e);
  13563. }, 0) : b.cache.add(n, r.html());
  13564. }, urlData: { tab: n } },
  13565. l = r.api("get request") || !1,
  13566. 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);
  13567. } }, activate: { all: function all(e) {
  13568. b.activate.tab(e), b.activate.navigation(e);
  13569. }, tab: function tab(e) {
  13570. var t = b.get.tabElement(e),
  13571. n = "siblings" == x.deactivate ? t.siblings(p) : p.not(t),
  13572. 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));
  13573. }, navigation: function navigation(e) {
  13574. var t = b.get.navElement(e),
  13575. n = "siblings" == x.deactivate ? t.siblings(r) : r.not(t),
  13576. i = t.hasClass(C.active);b.verbose("Activating tab navigation for", t, e), i || (t.addClass(C.active), n.removeClass(C.active + " " + C.loading));
  13577. } }, deactivate: { all: function all() {
  13578. b.deactivate.navigation(), b.deactivate.tabs();
  13579. }, navigation: function navigation() {
  13580. r.removeClass(C.active);
  13581. }, tabs: function tabs() {
  13582. p.removeClass(C.active + " " + C.loading);
  13583. } }, is: { tab: function tab(e) {
  13584. return e !== i && b.get.tabElement(e).length > 0;
  13585. } }, get: { initialPath: function initialPath() {
  13586. return r.eq(0).data(w.tab) || p.eq(0).data(w.tab);
  13587. }, path: function path() {
  13588. return e.address.value();
  13589. }, defaultPathArray: function defaultPathArray(e) {
  13590. return b.utilities.pathToArray(b.get.defaultPath(e));
  13591. }, defaultPath: function defaultPath(e) {
  13592. var t = r.filter("[data-" + w.tab + '^="' + e + '/"]').eq(0).data(w.tab) || !1;if (t) {
  13593. if (b.debug("Found default tab", t), F < x.maxDepth) return F++, b.get.defaultPath(t);b.error(k.recursion);
  13594. } else b.debug("No default tabs found for", e, p);return F = 0, e;
  13595. }, navElement: function navElement(e) {
  13596. return e = e || h, r.filter("[data-" + w.tab + '="' + e + '"]');
  13597. }, tabElement: function tabElement(e) {
  13598. 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;
  13599. }, tab: function tab() {
  13600. return h;
  13601. } }, utilities: { filterArray: function filterArray(t, n) {
  13602. return e.grep(t, function (t) {
  13603. return -1 == e.inArray(t, n);
  13604. });
  13605. }, last: function last(t) {
  13606. return !!e.isArray(t) && t[t.length - 1];
  13607. }, pathToArray: function pathToArray(e) {
  13608. return e === i && (e = h), "string" == typeof e ? e.split("/") : [e];
  13609. }, arrayToPath: function arrayToPath(t) {
  13610. return !!e.isArray(t) && t.join("/");
  13611. } }, setting: function setting(t, n) {
  13612. if (b.debug("Changing setting", t, n), e.isPlainObject(t)) e.extend(!0, x, t);else {
  13613. if (n === i) return x[t];e.isPlainObject(x[t]) ? e.extend(!0, x[t], n) : x[t] = n;
  13614. }
  13615. }, internal: function internal(t, n) {
  13616. if (e.isPlainObject(t)) e.extend(!0, b, t);else {
  13617. if (n === i) return b[t];b[t] = n;
  13618. }
  13619. }, debug: function debug() {
  13620. !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)));
  13621. }, verbose: function verbose() {
  13622. !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)));
  13623. }, error: function error() {
  13624. x.silent || (b.error = Function.prototype.bind.call(console.error, console, x.name + ":"), b.error.apply(console, arguments));
  13625. }, performance: { log: function log(e) {
  13626. 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);
  13627. }, display: function display() {
  13628. var t = x.name + ":",
  13629. n = 0;l = !1, clearTimeout(b.performance.timer), e.each(c, function (e, t) {
  13630. n += t["Execution Time"];
  13631. }), 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) {
  13632. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  13633. }), console.groupEnd()), c = [];
  13634. } }, invoke: function invoke(t, n, o) {
  13635. var r,
  13636. s,
  13637. l,
  13638. 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) {
  13639. 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 {
  13640. 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];
  13641. }
  13642. })), 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;
  13643. } }, d ? (D === i && b.initialize(), b.invoke(u)) : (D !== i && D.invoke("destroy"), b.initialize());
  13644. }), a !== i ? a : this;
  13645. }, e.tab = function () {
  13646. e(t).tab.apply(this, arguments);
  13647. }, 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" } };
  13648. }(jQuery, window, document), function (e, t, n, i) {
  13649. "use strict";
  13650. t = void 0 !== t && t.Math == Math ? t : "undefined" != typeof self && self.Math == Math ? self : Function("return this")(), e.fn.transition = function () {
  13651. var o,
  13652. a = e(this),
  13653. r = a.selector || "",
  13654. s = new Date().getTime(),
  13655. l = [],
  13656. c = arguments,
  13657. u = c[0],
  13658. d = [].slice.call(arguments, 1),
  13659. f = "string" == typeof u;t.requestAnimationFrame || t.mozRequestAnimationFrame || t.webkitRequestAnimationFrame || t.msRequestAnimationFrame;return a.each(function (t) {
  13660. var m,
  13661. g,
  13662. p,
  13663. h,
  13664. v,
  13665. b,
  13666. y,
  13667. x,
  13668. C,
  13669. w = e(this),
  13670. S = this;(C = { initialize: function initialize() {
  13671. 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());
  13672. }, instantiate: function instantiate() {
  13673. C.verbose("Storing instance of module", C), g = C, w.data(y, g);
  13674. }, destroy: function destroy() {
  13675. C.verbose("Destroying previous module for", S), w.removeData(y);
  13676. }, refresh: function refresh() {
  13677. C.verbose("Refreshing display type on next animation"), delete C.displayType;
  13678. }, forceRepaint: function forceRepaint() {
  13679. C.verbose("Forcing element repaint");var e = w.parent(),
  13680. t = w.next();0 === t.length ? w.detach().appendTo(e) : w.detach().insertBefore(t);
  13681. }, repaint: function repaint() {
  13682. C.verbose("Repainting element");S.offsetWidth;
  13683. }, delay: function delay(e) {
  13684. var n,
  13685. 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);
  13686. }, animate: function animate(e) {
  13687. if (m = e || m, !C.is.supported()) return C.error(p.support), !1;if (C.debug("Preparing animation", m.animation), C.is.animating()) {
  13688. 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();
  13689. }C.can.animate() ? C.set.animating(m.animation) : C.error(p.noAnimation, m.animation, S);
  13690. }, reset: function reset() {
  13691. C.debug("Resetting animation to beginning conditions"), C.remove.animationCallbacks(), C.restore.conditions(), C.remove.animating();
  13692. }, queue: function queue(e) {
  13693. C.debug("Queueing animation of", e), C.queuing = !0, w.one(b + ".queue" + x, function () {
  13694. C.queuing = !1, C.repaint(), C.animate.apply(this, m);
  13695. });
  13696. }, complete: function complete(e) {
  13697. 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)));
  13698. }, force: { visible: function visible() {
  13699. var e = w.attr("style"),
  13700. t = C.get.userStyle(),
  13701. n = C.get.displayType(),
  13702. o = t + "display: " + n + " !important;",
  13703. a = w.css("display"),
  13704. r = e === i || "" === e;a !== n ? (C.verbose("Overriding default display to show element", n), w.attr("style", o)) : r && w.removeAttr("style");
  13705. }, hidden: function hidden() {
  13706. var e = w.attr("style"),
  13707. t = w.css("display"),
  13708. 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"));
  13709. } }, has: { direction: function direction(t) {
  13710. var n = !1;return "string" == typeof (t = t || m.animation) && (t = t.split(" "), e.each(t, function (e, t) {
  13711. t !== h.inward && t !== h.outward || (n = !0);
  13712. })), n;
  13713. }, inlineDisplay: function inlineDisplay() {
  13714. var t = w.attr("style") || "";return e.isArray(t.match(/display.*?;/, ""));
  13715. } }, set: { animating: function animating(e) {
  13716. 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);
  13717. }, duration: function duration(e, t) {
  13718. ((t = "number" == typeof (t = t || m.duration) ? t + "ms" : t) || 0 === t) && (C.verbose("Setting animation duration", t), w.css({ "animation-duration": t }));
  13719. }, direction: function direction(e) {
  13720. (e = e || C.get.direction()) == h.inward ? C.set.inward() : C.set.outward();
  13721. }, looping: function looping() {
  13722. C.debug("Transition set to loop"), w.addClass(h.looping);
  13723. }, hidden: function hidden() {
  13724. w.addClass(h.transition).addClass(h.hidden);
  13725. }, inward: function inward() {
  13726. C.debug("Setting direction to inward"), w.removeClass(h.outward).addClass(h.inward);
  13727. }, outward: function outward() {
  13728. C.debug("Setting direction to outward"), w.removeClass(h.inward).addClass(h.outward);
  13729. }, visible: function visible() {
  13730. w.addClass(h.transition).addClass(h.visible);
  13731. } }, start: { animation: function animation(e) {
  13732. 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);
  13733. } }, save: { animation: function animation(e) {
  13734. C.cache || (C.cache = {}), C.cache.animation = e;
  13735. }, displayType: function displayType(e) {
  13736. "none" !== e && w.data(v.displayType, e);
  13737. }, transitionExists: function transitionExists(t, n) {
  13738. e.fn.transition.exists[t] = n, C.verbose("Saving existence of transition", t, n);
  13739. } }, restore: { conditions: function conditions() {
  13740. var e = C.get.currentAnimation();e && (w.removeClass(e), C.verbose("Removing animation class", C.cache)), C.remove.duration();
  13741. } }, add: { failSafe: function failSafe() {
  13742. var e = C.get.duration();C.timer = setTimeout(function () {
  13743. w.triggerHandler(b);
  13744. }, e + m.failSafeDelay), C.verbose("Adding fail safe timer", C.timer);
  13745. } }, remove: { animating: function animating() {
  13746. w.removeClass(h.animating);
  13747. }, animationCallbacks: function animationCallbacks() {
  13748. C.remove.queueCallback(), C.remove.completeCallback();
  13749. }, queueCallback: function queueCallback() {
  13750. w.off(".queue" + x);
  13751. }, completeCallback: function completeCallback() {
  13752. w.off(".complete" + x);
  13753. }, display: function display() {
  13754. w.css("display", "");
  13755. }, direction: function direction() {
  13756. w.removeClass(h.inward).removeClass(h.outward);
  13757. }, duration: function duration() {
  13758. w.css("animation-duration", "");
  13759. }, failSafe: function failSafe() {
  13760. C.verbose("Removing fail safe timer", C.timer), C.timer && clearTimeout(C.timer);
  13761. }, hidden: function hidden() {
  13762. w.removeClass(h.hidden);
  13763. }, visible: function visible() {
  13764. w.removeClass(h.visible);
  13765. }, looping: function looping() {
  13766. C.debug("Transitions are no longer looping"), C.is.looping() && (C.reset(), w.removeClass(h.looping));
  13767. }, transition: function transition() {
  13768. w.removeClass(h.visible).removeClass(h.hidden);
  13769. } }, get: { settings: function settings(t, n, i) {
  13770. 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 });
  13771. }, animationClass: function animationClass(e) {
  13772. var t = e || m.animation,
  13773. n = C.can.transition() && !C.has.direction() ? C.get.direction() + " " : "";return h.animating + " " + h.transition + " " + n + t;
  13774. }, currentAnimation: function currentAnimation() {
  13775. return !(!C.cache || C.cache.animation === i) && C.cache.animation;
  13776. }, currentDirection: function currentDirection() {
  13777. return C.is.inward() ? h.inward : h.outward;
  13778. }, direction: function direction() {
  13779. return C.is.hidden() || !C.is.visible() ? h.inward : h.outward;
  13780. }, animationDirection: function animationDirection(t) {
  13781. var n;return "string" == typeof (t = t || m.animation) && (t = t.split(" "), e.each(t, function (e, t) {
  13782. t === h.inward ? n = h.inward : t === h.outward && (n = h.outward);
  13783. })), n || !1;
  13784. }, duration: function duration(e) {
  13785. 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;
  13786. }, displayType: function displayType(e) {
  13787. return e = e === i || e, m.displayType ? m.displayType : (e && w.data(v.displayType) === i && C.can.transition(!0), w.data(v.displayType));
  13788. }, userStyle: function userStyle(e) {
  13789. return (e = e || w.attr("style") || "").replace(/display.*?;/, "");
  13790. }, transitionExists: function transitionExists(t) {
  13791. return e.fn.transition.exists[t];
  13792. }, animationStartEvent: function animationStartEvent() {
  13793. var e,
  13794. t = n.createElement("div"),
  13795. o = { animation: "animationstart", OAnimation: "oAnimationStart", MozAnimation: "mozAnimationStart", WebkitAnimation: "webkitAnimationStart" };for (e in o) {
  13796. if (t.style[e] !== i) return o[e];
  13797. }return !1;
  13798. }, animationEndEvent: function animationEndEvent() {
  13799. var e,
  13800. t = n.createElement("div"),
  13801. o = { animation: "animationend", OAnimation: "oAnimationEnd", MozAnimation: "mozAnimationEnd", WebkitAnimation: "webkitAnimationEnd" };for (e in o) {
  13802. if (t.style[e] !== i) return o[e];
  13803. }return !1;
  13804. } }, can: { transition: function transition(t) {
  13805. var n,
  13806. o,
  13807. a,
  13808. r,
  13809. s,
  13810. l,
  13811. c = m.animation,
  13812. u = C.get.transitionExists(c),
  13813. d = C.get.displayType(!1);if (u === i || t) {
  13814. 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 {
  13815. if ("none" == r || !r) return void C.debug("No animation defined in css", c);C.debug("Static animation found", c, d), l = !1;
  13816. }C.save.transitionExists(c, l);
  13817. }return u !== i ? u : l;
  13818. }, animate: function animate() {
  13819. return C.can.transition() !== i;
  13820. } }, is: { animating: function animating() {
  13821. return w.hasClass(h.animating);
  13822. }, inward: function inward() {
  13823. return w.hasClass(h.inward);
  13824. }, outward: function outward() {
  13825. return w.hasClass(h.outward);
  13826. }, looping: function looping() {
  13827. return w.hasClass(h.looping);
  13828. }, occurring: function occurring(e) {
  13829. return e = "." + (e = e || m.animation).replace(" ", "."), w.filter(e).length > 0;
  13830. }, visible: function visible() {
  13831. return w.is(":visible");
  13832. }, hidden: function hidden() {
  13833. return "hidden" === w.css("visibility");
  13834. }, supported: function supported() {
  13835. return !1 !== b;
  13836. } }, hide: function hide() {
  13837. 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);
  13838. }, show: function show(e) {
  13839. C.verbose("Showing element", e), C.remove.hidden(), C.set.visible(), C.force.visible(), m.onShow.call(S), m.onComplete.call(S);
  13840. }, toggle: function toggle() {
  13841. C.is.visible() ? C.hide() : C.show();
  13842. }, stop: function stop() {
  13843. C.debug("Stopping current animation"), w.triggerHandler(b);
  13844. }, stopAll: function stopAll() {
  13845. C.debug("Stopping all animation"), C.remove.queueCallback(), w.triggerHandler(b);
  13846. }, clear: { queue: function queue() {
  13847. C.debug("Clearing animation queue"), C.remove.queueCallback();
  13848. } }, enable: function enable() {
  13849. C.verbose("Starting animation"), w.removeClass(h.disabled);
  13850. }, disable: function disable() {
  13851. C.debug("Stopping animation"), w.addClass(h.disabled);
  13852. }, setting: function setting(t, n) {
  13853. if (C.debug("Changing setting", t, n), e.isPlainObject(t)) e.extend(!0, m, t);else {
  13854. if (n === i) return m[t];e.isPlainObject(m[t]) ? e.extend(!0, m[t], n) : m[t] = n;
  13855. }
  13856. }, internal: function internal(t, n) {
  13857. if (e.isPlainObject(t)) e.extend(!0, C, t);else {
  13858. if (n === i) return C[t];C[t] = n;
  13859. }
  13860. }, debug: function debug() {
  13861. !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)));
  13862. }, verbose: function verbose() {
  13863. !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)));
  13864. }, error: function error() {
  13865. m.silent || (C.error = Function.prototype.bind.call(console.error, console, m.name + ":"), C.error.apply(console, arguments));
  13866. }, performance: { log: function log(e) {
  13867. 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);
  13868. }, display: function display() {
  13869. var t = m.name + ":",
  13870. n = 0;s = !1, clearTimeout(C.performance.timer), e.each(l, function (e, t) {
  13871. n += t["Execution Time"];
  13872. }), 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) {
  13873. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  13874. }), console.groupEnd()), l = [];
  13875. } }, invoke: function invoke(t, n, a) {
  13876. var r,
  13877. s,
  13878. l,
  13879. 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) {
  13880. 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 {
  13881. 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];
  13882. }
  13883. })), 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;
  13884. } }).initialize();
  13885. }), o !== i ? o : this;
  13886. }, 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" } };
  13887. }(jQuery, window, document), function (e, t, n, i) {
  13888. "use strict";
  13889. 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) {
  13890. var o,
  13891. a = e.isFunction(this) ? e(t) : e(this),
  13892. r = a.selector || "",
  13893. s = new Date().getTime(),
  13894. l = [],
  13895. c = arguments[0],
  13896. u = "string" == typeof c,
  13897. d = [].slice.call(arguments, 1);return a.each(function () {
  13898. var a,
  13899. f,
  13900. m,
  13901. g,
  13902. p,
  13903. h,
  13904. v = e.isPlainObject(n) ? e.extend(!0, {}, e.fn.api.settings, n) : e.extend({}, e.fn.api.settings),
  13905. b = v.namespace,
  13906. y = v.metadata,
  13907. x = v.selector,
  13908. C = v.error,
  13909. w = v.className,
  13910. S = "." + b,
  13911. k = "module-" + b,
  13912. T = e(this),
  13913. A = T.closest(x.form),
  13914. R = v.stateContext ? e(v.stateContext) : T,
  13915. P = this,
  13916. E = R[0],
  13917. F = T.data(k);h = { initialize: function initialize() {
  13918. u || h.bind.events(), h.instantiate();
  13919. }, instantiate: function instantiate() {
  13920. h.verbose("Storing instance of module", h), F = h, T.data(k, F);
  13921. }, destroy: function destroy() {
  13922. h.verbose("Destroying previous module for", P), T.removeData(k).off(S);
  13923. }, bind: { events: function events() {
  13924. 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());
  13925. } }, decode: { json: function json(e) {
  13926. if (e !== i && "string" == typeof e) try {
  13927. e = JSON.parse(e);
  13928. } catch (e) {}return e;
  13929. } }, read: { cachedResponse: function cachedResponse(e) {
  13930. 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);
  13931. } }, write: { cachedResponse: function cachedResponse(n, o) {
  13932. 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);
  13933. } }, query: function query() {
  13934. if (h.is.disabled()) h.debug("Element is disabled API request aborted");else {
  13935. if (h.is.loading()) {
  13936. if (!v.interruptRequests) return void h.debug("Cancelling request, previous request is still pending");h.debug("Interrupting previous request"), h.abort();
  13937. }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()) {
  13938. if ((m = h.add.urlData(m)) || h.is.mocked()) {
  13939. 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 () {
  13940. h.timer && delete h.timer, h.debug("Sending throttled request", g, a.method), h.send.request();
  13941. }, 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());
  13942. }
  13943. } else h.error(C.missingURL);
  13944. }
  13945. }, should: { removeError: function removeError() {
  13946. return !0 === v.hideError || "auto" === v.hideError && !h.is.form();
  13947. } }, is: { disabled: function disabled() {
  13948. return T.filter(x.disabled).length > 0;
  13949. }, expectingJSON: function expectingJSON() {
  13950. return "json" === v.dataType || "jsonp" === v.dataType;
  13951. }, form: function form() {
  13952. return T.is("form") || R.is("form");
  13953. }, mocked: function mocked() {
  13954. return v.mockResponse || v.mockResponseAsync || v.response || v.responseAsync;
  13955. }, input: function input() {
  13956. return T.is("input");
  13957. }, loading: function loading() {
  13958. return !!h.request && "pending" == h.request.state();
  13959. }, abortedRequest: function abortedRequest(e) {
  13960. 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);
  13961. }, validResponse: function validResponse(t) {
  13962. 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);
  13963. } }, was: { cancelled: function cancelled() {
  13964. return h.cancelled || !1;
  13965. }, succesful: function succesful() {
  13966. return h.request && "resolved" == h.request.state();
  13967. }, failure: function failure() {
  13968. return h.request && "rejected" == h.request.state();
  13969. }, complete: function complete() {
  13970. return h.request && ("resolved" == h.request.state() || "rejected" == h.request.state());
  13971. } }, add: { urlData: function urlData(t, n) {
  13972. 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) {
  13973. var r = -1 !== a.indexOf("$") ? a.substr(2, a.length - 3) : a.substr(1, a.length - 2),
  13974. 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);
  13975. })), a && (h.debug("Looking for optional URL variables", o), e.each(a, function (o, a) {
  13976. var r = -1 !== a.indexOf("$") ? a.substr(3, a.length - 4) : a.substr(2, a.length - 3),
  13977. 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, ""));
  13978. }))), t;
  13979. }, formData: function formData(t) {
  13980. var n = e.fn.serializeObject !== i,
  13981. 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;
  13982. } }, send: { request: function request() {
  13983. 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);
  13984. } }, event: { trigger: function trigger(e) {
  13985. h.query(), "submit" != e.type && "click" != e.type || e.preventDefault();
  13986. }, xhr: { always: function always() {}, done: function done(t, n, i) {
  13987. var o = this,
  13988. a = new Date().getTime() - p,
  13989. r = v.loadingDuration - a,
  13990. 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 () {
  13991. h.is.validResponse(t) ? h.request.resolveWith(o, [t, i]) : h.request.rejectWith(o, [i, "invalid"]);
  13992. }, r);
  13993. }, fail: function fail(e, t, n) {
  13994. var i = this,
  13995. o = new Date().getTime() - p,
  13996. a = v.loadingDuration - o;(a = a > 0 ? a : 0) > 0 && h.debug("Response completed early delaying state change by", a), setTimeout(function () {
  13997. h.is.abortedRequest(e) ? h.request.rejectWith(i, [e, "aborted", n]) : h.request.rejectWith(i, [e, "error", t, n]);
  13998. }, a);
  13999. } }, request: { done: function done(e, t) {
  14000. 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);
  14001. }, complete: function complete(e, t) {
  14002. 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);
  14003. }, fail: function fail(e, t, n) {
  14004. var o = h.get.responseFromXHR(e),
  14005. 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);
  14006. } } }, create: { request: function request() {
  14007. return e.Deferred().always(h.event.request.complete).done(h.event.request.done).fail(h.event.request.fail);
  14008. }, mockedXHR: function mockedXHR() {
  14009. var t,
  14010. n,
  14011. i,
  14012. o = v.mockResponse || v.response,
  14013. 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) {
  14014. h.debug("Async callback returned response", e), e ? i.resolveWith(E, [e, !1, { responseText: e }]) : i.rejectWith(E, [{ responseText: e }, !1, !1]);
  14015. }, h.debug("Using specified async response callback", a), a.call(E, f, t)), i;
  14016. }, xhr: function xhr() {
  14017. 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;
  14018. } }, set: { error: function error() {
  14019. h.verbose("Adding error state to element", R), R.addClass(w.error);
  14020. }, loading: function loading() {
  14021. h.verbose("Adding loading state to element", R), R.addClass(w.loading), p = new Date().getTime();
  14022. } }, remove: { error: function error() {
  14023. h.verbose("Removing error state from element", R), R.removeClass(w.error);
  14024. }, loading: function loading() {
  14025. h.verbose("Removing loading state from element", R), R.removeClass(w.loading);
  14026. } }, get: { responseFromXHR: function responseFromXHR(t) {
  14027. return !!e.isPlainObject(t) && (h.is.expectingJSON() ? h.decode.json(t.responseText) : t.responseText);
  14028. }, errorFromRequest: function errorFromRequest(t, n, o) {
  14029. return e.isPlainObject(t) && t.error !== i ? t.error : v.error[n] !== i ? v.error[n] : o;
  14030. }, request: function request() {
  14031. return h.request || !1;
  14032. }, xhr: function xhr() {
  14033. return h.xhr || !1;
  14034. }, settings: function settings() {
  14035. 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);
  14036. }, urlEncodedValue: function urlEncodedValue(e) {
  14037. var n = t.decodeURIComponent(e),
  14038. 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);
  14039. }, defaultData: function defaultData() {
  14040. var t = {};return e.isWindow(P) || (h.is.input() ? t.value = T.val() : h.is.form() || (t.text = T.text())), t;
  14041. }, event: function event() {
  14042. 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;
  14043. }, templatedURL: function templatedURL(e) {
  14044. 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) {
  14045. 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];
  14046. } 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;
  14047. } }, abort: function abort() {
  14048. var e = h.get.xhr();e && "resolved" !== e.state() && (h.debug("Cancelling API request"), e.abort());
  14049. }, reset: function reset() {
  14050. h.remove.error(), h.remove.loading();
  14051. }, setting: function setting(t, n) {
  14052. if (h.debug("Changing setting", t, n), e.isPlainObject(t)) e.extend(!0, v, t);else {
  14053. if (n === i) return v[t];e.isPlainObject(v[t]) ? e.extend(!0, v[t], n) : v[t] = n;
  14054. }
  14055. }, internal: function internal(t, n) {
  14056. if (e.isPlainObject(t)) e.extend(!0, h, t);else {
  14057. if (n === i) return h[t];h[t] = n;
  14058. }
  14059. }, debug: function debug() {
  14060. !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)));
  14061. }, verbose: function verbose() {
  14062. !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)));
  14063. }, error: function error() {
  14064. v.silent || (h.error = Function.prototype.bind.call(console.error, console, v.name + ":"), h.error.apply(console, arguments));
  14065. }, performance: { log: function log(e) {
  14066. 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);
  14067. }, display: function display() {
  14068. var t = v.name + ":",
  14069. n = 0;s = !1, clearTimeout(h.performance.timer), e.each(l, function (e, t) {
  14070. n += t["Execution Time"];
  14071. }), 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) {
  14072. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  14073. }), console.groupEnd()), l = [];
  14074. } }, invoke: function invoke(t, n, a) {
  14075. var r,
  14076. s,
  14077. l,
  14078. 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) {
  14079. 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 {
  14080. 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];
  14081. }
  14082. })), 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;
  14083. } }, u ? (F === i && h.initialize(), h.invoke(c)) : (F !== i && F.invoke("destroy"), h.initialize());
  14084. }), o !== i ? o : this;
  14085. }, 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) {
  14086. return e;
  14087. }, 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" } };
  14088. }(jQuery, window, document), function (e, t, n, i) {
  14089. "use strict";
  14090. t = void 0 !== t && t.Math == Math ? t : "undefined" != typeof self && self.Math == Math ? self : Function("return this")(), e.fn.visibility = function (o) {
  14091. var a,
  14092. r = e(this),
  14093. s = r.selector || "",
  14094. l = new Date().getTime(),
  14095. c = [],
  14096. u = arguments[0],
  14097. d = "string" == typeof u,
  14098. f = [].slice.call(arguments, 1),
  14099. m = r.length,
  14100. g = 0;return r.each(function () {
  14101. var r,
  14102. p,
  14103. h,
  14104. v,
  14105. b = e.isPlainObject(o) ? e.extend(!0, {}, e.fn.visibility.settings, o) : e.extend({}, e.fn.visibility.settings),
  14106. y = b.className,
  14107. x = b.namespace,
  14108. C = b.error,
  14109. w = b.metadata,
  14110. S = "." + x,
  14111. k = "module-" + x,
  14112. T = e(t),
  14113. A = e(this),
  14114. R = e(b.context),
  14115. P = (A.selector, A.data(k)),
  14116. E = t.requestAnimationFrame || t.mozRequestAnimationFrame || t.webkitRequestAnimationFrame || t.msRequestAnimationFrame || function (e) {
  14117. setTimeout(e, 0);
  14118. },
  14119. F = this,
  14120. O = !1;v = { initialize: function initialize() {
  14121. 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();
  14122. }, instantiate: function instantiate() {
  14123. v.debug("Storing instance", v), A.data(k, v), P = v;
  14124. }, destroy: function destroy() {
  14125. 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);
  14126. }, observeChanges: function observeChanges() {
  14127. "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));
  14128. }, bind: { events: function events() {
  14129. 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);
  14130. } }, event: { changed: function changed(e) {
  14131. v.verbose("DOM tree modified, updating visibility calculations"), v.timer = setTimeout(function () {
  14132. v.verbose("DOM tree modified, updating sticky menu"), v.refresh();
  14133. }, 100);
  14134. }, contextChanged: function contextChanged(t) {
  14135. [].forEach.call(t, function (t) {
  14136. t.removedNodes && [].forEach.call(t.removedNodes, function (t) {
  14137. (t == F || e(t).find(F).length > 0) && (v.debug("Element removed from DOM, tearing down events"), v.destroy());
  14138. });
  14139. });
  14140. }, resize: function resize() {
  14141. v.debug("Window resized"), b.refreshOnResize && E(v.refresh);
  14142. }, load: function load() {
  14143. v.debug("Page finished loading"), E(v.refresh);
  14144. }, scroll: function scroll() {
  14145. b.throttle ? (clearTimeout(v.timer), v.timer = setTimeout(function () {
  14146. R.triggerHandler("scrollchange" + S, [R.scrollTop()]);
  14147. }, b.throttle)) : E(function () {
  14148. R.triggerHandler("scrollchange" + S, [R.scrollTop()]);
  14149. });
  14150. }, scrollchange: function scrollchange(e, t) {
  14151. v.checkVisibility(t);
  14152. } }, precache: function precache(t, i) {
  14153. t instanceof Array || (t = [t]);for (var o = t.length, a = 0, r = [], s = n.createElement("img"), l = function l() {
  14154. ++a >= t.length && e.isFunction(i) && i();
  14155. }; o--;) {
  14156. (s = n.createElement("img")).onload = l, s.onerror = l, s.src = t[o], r.push(s);
  14157. }
  14158. }, enableCallbacks: function enableCallbacks() {
  14159. v.debug("Allowing callbacks to occur"), O = !1;
  14160. }, disableCallbacks: function disableCallbacks() {
  14161. v.debug("Disabling all callbacks temporarily"), O = !0;
  14162. }, should: { trackChanges: function trackChanges() {
  14163. return d ? (v.debug("One time query, no need to bind events"), !1) : (v.debug("Callbacks being attached"), !0);
  14164. } }, setup: { cache: function cache() {
  14165. v.cache = { occurred: {}, screen: {}, element: {} };
  14166. }, image: function image() {
  14167. var e = A.data(w.src);e && (v.verbose("Lazy loading image", e), b.once = !0, b.observeChanges = !1, b.onOnScreen = function () {
  14168. v.debug("Image on screen", F), v.precache(e, function () {
  14169. v.set.image(e, function () {
  14170. ++g == m && b.onAllLoaded.call(this), b.onLoad.call(this);
  14171. });
  14172. });
  14173. });
  14174. }, fixed: function fixed() {
  14175. 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 () {
  14176. 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);
  14177. }, b.onTopPassedReverse = function () {
  14178. v.debug("Element returned to position, removing fixed", A), v.hide.placeholder(), v.remove.fixed();
  14179. };
  14180. } }, create: { placeholder: function placeholder() {
  14181. v.verbose("Creating fixed position placeholder"), r = A.clone(!1).css("display", "none").addClass(y.placeholder).insertAfter(A);
  14182. } }, show: { placeholder: function placeholder() {
  14183. v.verbose("Showing placeholder"), r.css("display", "block").css("visibility", "hidden");
  14184. } }, hide: { placeholder: function placeholder() {
  14185. v.verbose("Hiding placeholder"), r.css("display", "none").css("visibility", "");
  14186. } }, set: { fixed: function fixed() {
  14187. 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);
  14188. }, image: function image(t, n) {
  14189. if (A.attr("src", t), b.transition) {
  14190. if (e.fn.transition !== i) {
  14191. if (A.hasClass(y.visible)) return void v.debug("Transition already occurred on this image, skipping animation");A.transition(b.transition, b.duration, n);
  14192. } else A.fadeIn(b.duration, n);
  14193. } else A.show();
  14194. } }, is: { onScreen: function onScreen() {
  14195. return v.get.elementCalculations().onScreen;
  14196. }, offScreen: function offScreen() {
  14197. return v.get.elementCalculations().offScreen;
  14198. }, visible: function visible() {
  14199. return !(!v.cache || !v.cache.element) && !(0 === v.cache.element.width && 0 === v.cache.element.offset.top);
  14200. }, verticallyScrollableContext: function verticallyScrollableContext() {
  14201. var e = R.get(0) !== t && R.css("overflow-y");return "auto" == e || "scroll" == e;
  14202. }, horizontallyScrollableContext: function horizontallyScrollableContext() {
  14203. var e = R.get(0) !== t && R.css("overflow-x");return "auto" == e || "scroll" == e;
  14204. } }, refresh: function refresh() {
  14205. v.debug("Refreshing constants (width/height)"), "fixed" == b.type && v.resetFixed(), v.reset(), v.save.position(), b.checkOnRefresh && v.checkVisibility(), b.onRefresh.call(F);
  14206. }, resetFixed: function resetFixed() {
  14207. v.remove.fixed(), v.remove.occurred();
  14208. }, reset: function reset() {
  14209. v.verbose("Resetting all cached values"), e.isPlainObject(v.cache) && (v.cache.screen = {}, v.cache.element = {});
  14210. }, checkVisibility: function checkVisibility(e) {
  14211. 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()));
  14212. }, passed: function passed(t, n) {
  14213. var o = v.get.elementCalculations();if (t && n) b.onPassed[t] = n;else {
  14214. if (t !== i) return v.get.pixelsPassed(t) > o.pixelsPassed;o.passing && e.each(b.onPassed, function (e, t) {
  14215. o.bottomVisible || o.pixelsPassed > v.get.pixelsPassed(e) ? v.execute(t, e) : b.once || v.remove.occurred(t);
  14216. });
  14217. }
  14218. }, onScreen: function onScreen(e) {
  14219. var t = v.get.elementCalculations(),
  14220. n = e || b.onOnScreen,
  14221. 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;
  14222. }, offScreen: function offScreen(e) {
  14223. var t = v.get.elementCalculations(),
  14224. n = e || b.onOffScreen,
  14225. 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;
  14226. }, passing: function passing(e) {
  14227. var t = v.get.elementCalculations(),
  14228. n = e || b.onPassing,
  14229. 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;
  14230. }, topVisible: function topVisible(e) {
  14231. var t = v.get.elementCalculations(),
  14232. n = e || b.onTopVisible,
  14233. 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;
  14234. }, bottomVisible: function bottomVisible(e) {
  14235. var t = v.get.elementCalculations(),
  14236. n = e || b.onBottomVisible,
  14237. 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;
  14238. }, topPassed: function topPassed(e) {
  14239. var t = v.get.elementCalculations(),
  14240. n = e || b.onTopPassed,
  14241. 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;
  14242. }, bottomPassed: function bottomPassed(e) {
  14243. var t = v.get.elementCalculations(),
  14244. n = e || b.onBottomPassed,
  14245. 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;
  14246. }, passingReverse: function passingReverse(e) {
  14247. var t = v.get.elementCalculations(),
  14248. n = e || b.onPassingReverse,
  14249. 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;
  14250. }, topVisibleReverse: function topVisibleReverse(e) {
  14251. var t = v.get.elementCalculations(),
  14252. n = e || b.onTopVisibleReverse,
  14253. 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;
  14254. }, bottomVisibleReverse: function bottomVisibleReverse(e) {
  14255. var t = v.get.elementCalculations(),
  14256. n = e || b.onBottomVisibleReverse,
  14257. 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;
  14258. }, topPassedReverse: function topPassedReverse(e) {
  14259. var t = v.get.elementCalculations(),
  14260. n = e || b.onTopPassedReverse,
  14261. 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;
  14262. }, bottomPassedReverse: function bottomPassedReverse(e) {
  14263. var t = v.get.elementCalculations(),
  14264. n = e || b.onBottomPassedReverse,
  14265. 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;
  14266. }, execute: function execute(e, t) {
  14267. var n = v.get.elementCalculations(),
  14268. 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);
  14269. }, remove: { fixed: function fixed() {
  14270. v.debug("Removing fixed position"), A.removeClass(y.fixed).css({ position: "", top: "", left: "", zIndex: "" }), b.onUnfixed.call(F);
  14271. }, placeholder: function placeholder() {
  14272. v.debug("Removing placeholder content"), r && r.remove();
  14273. }, occurred: function occurred(e) {
  14274. if (e) {
  14275. 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);
  14276. } else v.cache.occurred = {};
  14277. } }, save: { calculations: function calculations() {
  14278. v.verbose("Saving all calculations necessary to determine positioning"), v.save.direction(), v.save.screenCalculations(), v.save.elementCalculations();
  14279. }, occurred: function occurred(e) {
  14280. e && (v.cache.occurred[e] !== i && !0 === v.cache.occurred[e] || (v.verbose("Saving callback occurred", e), v.cache.occurred[e] = !0));
  14281. }, scroll: function scroll(e) {
  14282. e = e + b.offset || R.scrollTop() + b.offset, v.cache.scroll = e;
  14283. }, direction: function direction() {
  14284. var e,
  14285. t = v.get.scroll(),
  14286. n = v.get.lastScroll();return e = t > n && n ? "down" : t < n && n ? "up" : "static", v.cache.direction = e, v.cache.direction;
  14287. }, elementPosition: function elementPosition() {
  14288. var e = v.cache.element,
  14289. 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;
  14290. }, elementCalculations: function elementCalculations() {
  14291. var e = v.get.screenCalculations(),
  14292. 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;
  14293. }, screenCalculations: function screenCalculations() {
  14294. 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;
  14295. }, screenSize: function screenSize() {
  14296. v.verbose("Saving window position"), v.cache.screen = { height: R.height() };
  14297. }, position: function position() {
  14298. v.save.screenSize(), v.save.elementPosition();
  14299. } }, get: { pixelsPassed: function pixelsPassed(e) {
  14300. var t = v.get.elementCalculations();return e.search("%") > -1 ? t.height * (parseInt(e, 10) / 100) : parseInt(e, 10);
  14301. }, occurred: function occurred(e) {
  14302. return v.cache.occurred !== i && v.cache.occurred[e] || !1;
  14303. }, direction: function direction() {
  14304. return v.cache.direction === i && v.save.direction(), v.cache.direction;
  14305. }, elementPosition: function elementPosition() {
  14306. return v.cache.element === i && v.save.elementPosition(), v.cache.element;
  14307. }, elementCalculations: function elementCalculations() {
  14308. return v.cache.element === i && v.save.elementCalculations(), v.cache.element;
  14309. }, screenCalculations: function screenCalculations() {
  14310. return v.cache.screen === i && v.save.screenCalculations(), v.cache.screen;
  14311. }, screenSize: function screenSize() {
  14312. return v.cache.screen === i && v.save.screenSize(), v.cache.screen;
  14313. }, scroll: function scroll() {
  14314. return v.cache.scroll === i && v.save.scroll(), v.cache.scroll;
  14315. }, lastScroll: function lastScroll() {
  14316. return v.cache.screen === i ? (v.debug("First scroll event, no last scroll could be found"), !1) : v.cache.screen.top;
  14317. } }, setting: function setting(t, n) {
  14318. if (e.isPlainObject(t)) e.extend(!0, b, t);else {
  14319. if (n === i) return b[t];b[t] = n;
  14320. }
  14321. }, internal: function internal(t, n) {
  14322. if (e.isPlainObject(t)) e.extend(!0, v, t);else {
  14323. if (n === i) return v[t];v[t] = n;
  14324. }
  14325. }, debug: function debug() {
  14326. !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)));
  14327. }, verbose: function verbose() {
  14328. !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)));
  14329. }, error: function error() {
  14330. b.silent || (v.error = Function.prototype.bind.call(console.error, console, b.name + ":"), v.error.apply(console, arguments));
  14331. }, performance: { log: function log(e) {
  14332. 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);
  14333. }, display: function display() {
  14334. var t = b.name + ":",
  14335. n = 0;l = !1, clearTimeout(v.performance.timer), e.each(c, function (e, t) {
  14336. n += t["Execution Time"];
  14337. }), 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) {
  14338. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  14339. }), console.groupEnd()), c = [];
  14340. } }, invoke: function invoke(t, n, o) {
  14341. var r,
  14342. s,
  14343. l,
  14344. 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) {
  14345. 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 {
  14346. 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];
  14347. }
  14348. })), 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;
  14349. } }, d ? (P === i && v.initialize(), P.save.scroll(), P.save.calculations(), v.invoke(u)) : (P !== i && P.invoke("destroy"), v.initialize());
  14350. }), a !== i ? a : this;
  14351. }, 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" } };
  14352. }(jQuery, window, document);
  14353. /***/ }),
  14354. /***/ "./js/services/i18nHelper.js":
  14355. /*!***********************************!*\
  14356. !*** ./js/services/i18nHelper.js ***!
  14357. \***********************************/
  14358. /*! no static exports found */
  14359. /***/ (function(module, exports, __webpack_require__) {
  14360. "use strict";
  14361. Object.defineProperty(exports, "__esModule", {
  14362. value: true
  14363. });
  14364. exports.i18nHelper = undefined;
  14365. var _lineI18n = __webpack_require__(/*! line-i18n */ "./node_modules/line-i18n/dist/index.js");
  14366. var _lineI18n2 = _interopRequireDefault(_lineI18n);
  14367. var _localizedStringsService = __webpack_require__(/*! ./localizedStringsService */ "./js/services/localizedStringsService.js");
  14368. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  14369. var StringTypes = _lineI18n2.default.StringTypes;
  14370. var i18nHelper = exports.i18nHelper = Object.freeze({
  14371. i18n: function i18n(identifier) {
  14372. var opts = identifier.split(':');
  14373. var type = opts[0].toLowerCase();
  14374. var id = opts[1];
  14375. if (StringTypes.ERROR === type) {
  14376. return _localizedStringsService.LocalizedStrings.getError(id);
  14377. } else if (StringTypes.MESSAGE === type) {
  14378. return _localizedStringsService.LocalizedStrings.getMessage(id);
  14379. } else if (StringTypes.UI === type) {
  14380. return _localizedStringsService.LocalizedStrings.getUI(id);
  14381. } else {
  14382. console.warn("A string has been passed to the i18n helper function that was not in the form type:id -> " + identifier);
  14383. return _localizedStringsService.LocalizedStrings.getString(identifier, type);
  14384. }
  14385. }
  14386. });
  14387. /***/ }),
  14388. /***/ "./js/services/languageService.js":
  14389. /*!****************************************!*\
  14390. !*** ./js/services/languageService.js ***!
  14391. \****************************************/
  14392. /*! no static exports found */
  14393. /***/ (function(module, exports, __webpack_require__) {
  14394. "use strict";
  14395. Object.defineProperty(exports, "__esModule", {
  14396. value: true
  14397. });
  14398. exports.LanguageService = undefined;
  14399. 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; }; }();
  14400. var _grammar = __webpack_require__(/*! ./../../grammar/ */ "./grammar/index.js");
  14401. var _grammar2 = _interopRequireDefault(_grammar);
  14402. var _lineI18n = __webpack_require__(/*! line-i18n */ "./node_modules/line-i18n/dist/index.js");
  14403. var _lineI18n2 = _interopRequireDefault(_lineI18n);
  14404. var _config = __webpack_require__(/*! ./../util/config */ "./js/util/config.js");
  14405. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  14406. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  14407. 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; }
  14408. 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; }
  14409. var LanguageServiceExtended = function (_line_i18n$LanguageSe) {
  14410. _inherits(LanguageServiceExtended, _line_i18n$LanguageSe);
  14411. function LanguageServiceExtended() {
  14412. _classCallCheck(this, LanguageServiceExtended);
  14413. return _possibleConstructorReturn(this, (LanguageServiceExtended.__proto__ || Object.getPrototypeOf(LanguageServiceExtended)).call(this, typeof iLMparameters === 'undefined' ? _config.Config.default_lang : iLMparameters.lang));
  14414. }
  14415. _createClass(LanguageServiceExtended, [{
  14416. key: 'getCurrentLexer',
  14417. value: function getCurrentLexer() {
  14418. var langInfo = _grammar2.default[this.getLang()];
  14419. if (langInfo === null || langInfo === undefined) {
  14420. return _grammar2.default[this.getDefaultLang()].lexer;
  14421. } else {
  14422. return langInfo.lexer;
  14423. }
  14424. }
  14425. }, {
  14426. key: 'getCurrentLangFuncs',
  14427. value: function getCurrentLangFuncs() {
  14428. var langInfo = _grammar2.default[this.getLang()];
  14429. if (langInfo === null || langInfo === undefined) {
  14430. return _grammar2.default[this.getDefaultLang()].langFuncs;
  14431. } else {
  14432. return langInfo.langFuncs;
  14433. }
  14434. }
  14435. }, {
  14436. key: 'getCurrentLangLibs',
  14437. value: function getCurrentLangLibs() {
  14438. var langInfo = _grammar2.default[this.getLang()];
  14439. if (langInfo === null || langInfo === undefined) {
  14440. return _grammar2.default[this.getDefaultLang()].langLibs;
  14441. }
  14442. return langInfo.langLibs;
  14443. }
  14444. }]);
  14445. return LanguageServiceExtended;
  14446. }(_lineI18n2.default.LanguageServiceNoLS);
  14447. var LanguageService = exports.LanguageService = new LanguageServiceExtended();
  14448. /***/ }),
  14449. /***/ "./js/services/localizedStringsService.js":
  14450. /*!************************************************!*\
  14451. !*** ./js/services/localizedStringsService.js ***!
  14452. \************************************************/
  14453. /*! no static exports found */
  14454. /***/ (function(module, exports, __webpack_require__) {
  14455. "use strict";
  14456. Object.defineProperty(exports, "__esModule", {
  14457. value: true
  14458. });
  14459. exports.LocalizedStrings = undefined;
  14460. var _languageService = __webpack_require__(/*! ./languageService */ "./js/services/languageService.js");
  14461. var _lineI18n = __webpack_require__(/*! line-i18n */ "./node_modules/line-i18n/dist/index.js");
  14462. var _lineI18n2 = _interopRequireDefault(_lineI18n);
  14463. var _i18n = __webpack_require__(/*! ./../../i18n */ "./i18n/index.js");
  14464. var _i18n2 = _interopRequireDefault(_i18n);
  14465. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  14466. var LocalizedStrings = exports.LocalizedStrings = Object.freeze(new _lineI18n2.default.LocalizedStrings(_languageService.LanguageService, _i18n2.default, true));
  14467. /***/ }),
  14468. /***/ "./js/typeSystem/baseTypes.js":
  14469. /*!************************************!*\
  14470. !*** ./js/typeSystem/baseTypes.js ***!
  14471. \************************************/
  14472. /*! no static exports found */
  14473. /***/ (function(module, exports, __webpack_require__) {
  14474. "use strict";
  14475. Object.defineProperty(exports, "__esModule", {
  14476. value: true
  14477. });
  14478. 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; }; }();
  14479. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  14480. var BaseType = function () {
  14481. function BaseType(name, ord) {
  14482. _classCallCheck(this, BaseType);
  14483. this.name = name;
  14484. this.ord = ord;
  14485. }
  14486. _createClass(BaseType, [{
  14487. key: "isCompatible",
  14488. value: function isCompatible(another) {
  14489. if (another instanceof BaseType) {
  14490. return this.name === another.name && this.ord === another.ord;
  14491. }
  14492. return false;
  14493. }
  14494. }, {
  14495. key: "value",
  14496. get: function get() {
  14497. return this.name;
  14498. }
  14499. }]);
  14500. return BaseType;
  14501. }();
  14502. // Base types names are the same as i18n ui type keys
  14503. var BaseTypes = exports.BaseTypes = Object.freeze({
  14504. INTEGER: new BaseType("integer", 0),
  14505. REAL: new BaseType("real", 1),
  14506. STRING: new BaseType("text", 2),
  14507. BOOLEAN: new BaseType("boolean", 3),
  14508. VOID: new BaseType("void", 4),
  14509. UNDEFINED: new BaseType("undefined", 5)
  14510. });
  14511. /***/ }),
  14512. /***/ "./js/typeSystem/compoundType.js":
  14513. /*!***************************************!*\
  14514. !*** ./js/typeSystem/compoundType.js ***!
  14515. \***************************************/
  14516. /*! no static exports found */
  14517. /***/ (function(module, exports, __webpack_require__) {
  14518. "use strict";
  14519. Object.defineProperty(exports, "__esModule", {
  14520. value: true
  14521. });
  14522. exports.CompoundType = undefined;
  14523. 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; }; }();
  14524. var _type = __webpack_require__(/*! ./type */ "./js/typeSystem/type.js");
  14525. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  14526. 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; }
  14527. 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; }
  14528. var CompoundType = exports.CompoundType = function (_Type) {
  14529. _inherits(CompoundType, _Type);
  14530. function CompoundType(type, dimensions) {
  14531. _classCallCheck(this, CompoundType);
  14532. var _this = _possibleConstructorReturn(this, (CompoundType.__proto__ || Object.getPrototypeOf(CompoundType)).call(this, null));
  14533. _this.innerType = type;
  14534. _this.dimensions = dimensions;
  14535. return _this;
  14536. }
  14537. _createClass(CompoundType, [{
  14538. key: "isCompatible",
  14539. value: function isCompatible(another) {
  14540. if (another instanceof CompoundType) {
  14541. if (this.dimensions !== another.dimensions) {
  14542. return false;
  14543. }
  14544. return this.innerType.isCompatible(another.innerType);
  14545. }
  14546. return false;
  14547. }
  14548. }, {
  14549. key: "stringInfo",
  14550. value: function stringInfo() {
  14551. var _this2 = this;
  14552. var list = this.innerType.stringInfo();
  14553. list.forEach(function (v) {
  14554. v.dim = _this2.dimensions;
  14555. });
  14556. return list;
  14557. }
  14558. }, {
  14559. key: "canAccept",
  14560. value: function canAccept(another) {
  14561. if (another instanceof CompoundType) {
  14562. return this.dimensions > another.dimensions && this.innerType.isCompatible(another.innerType);
  14563. } else {
  14564. return this.innerType.isCompatible(another);
  14565. }
  14566. }
  14567. }]);
  14568. return CompoundType;
  14569. }(_type.Type);
  14570. /***/ }),
  14571. /***/ "./js/typeSystem/multiType.js":
  14572. /*!************************************!*\
  14573. !*** ./js/typeSystem/multiType.js ***!
  14574. \************************************/
  14575. /*! no static exports found */
  14576. /***/ (function(module, exports, __webpack_require__) {
  14577. "use strict";
  14578. Object.defineProperty(exports, "__esModule", {
  14579. value: true
  14580. });
  14581. exports.MultiType = undefined;
  14582. 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; }; }();
  14583. var _type = __webpack_require__(/*! ./type */ "./js/typeSystem/type.js");
  14584. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  14585. 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; }
  14586. 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; }
  14587. var MultiType = exports.MultiType = function (_Type) {
  14588. _inherits(MultiType, _Type);
  14589. function MultiType(types) {
  14590. _classCallCheck(this, MultiType);
  14591. var _this = _possibleConstructorReturn(this, (MultiType.__proto__ || Object.getPrototypeOf(MultiType)).call(this, null));
  14592. _this.types = types;
  14593. return _this;
  14594. }
  14595. _createClass(MultiType, [{
  14596. key: "stringInfo",
  14597. value: function stringInfo() {
  14598. var list = [];
  14599. for (var i = 0; i < this.types.length; i++) {
  14600. var t = this.types[i];
  14601. list = list.concat(t.stringInfo());
  14602. }
  14603. return list;
  14604. }
  14605. }, {
  14606. key: "isCompatible",
  14607. value: function isCompatible(another) {
  14608. if (another instanceof _type.Type) {
  14609. for (var i = 0; i < this.types.length; i++) {
  14610. var t = this.types[i];
  14611. if (another.isCompatible(t)) {
  14612. return true;
  14613. }
  14614. }
  14615. }
  14616. return false;
  14617. }
  14618. }, {
  14619. key: "value",
  14620. get: function get() {
  14621. return null;
  14622. }
  14623. }, {
  14624. key: "ord",
  14625. get: function get() {
  14626. return null;
  14627. }
  14628. }]);
  14629. return MultiType;
  14630. }(_type.Type);
  14631. /***/ }),
  14632. /***/ "./js/typeSystem/parsers.js":
  14633. /*!**********************************!*\
  14634. !*** ./js/typeSystem/parsers.js ***!
  14635. \**********************************/
  14636. /*! no static exports found */
  14637. /***/ (function(module, exports, __webpack_require__) {
  14638. "use strict";
  14639. Object.defineProperty(exports, "__esModule", {
  14640. value: true
  14641. });
  14642. exports.toInt = toInt;
  14643. exports.toString = toString;
  14644. exports.toReal = toReal;
  14645. exports.toBool = toBool;
  14646. exports.convertToString = convertToString;
  14647. var _languageService = __webpack_require__(/*! ../services/languageService */ "./js/services/languageService.js");
  14648. var _types = __webpack_require__(/*! ./types */ "./js/typeSystem/types.js");
  14649. var _decimal = __webpack_require__(/*! decimal.js */ "./node_modules/decimal.js/decimal.js");
  14650. var _decimal2 = _interopRequireDefault(_decimal);
  14651. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  14652. function toInt(str) {
  14653. return new _decimal2.default(str);
  14654. }
  14655. function toString(str) {
  14656. var value = str.replace(/^"/, '');
  14657. value = value.replace(/"$/, '');
  14658. value = value.replace(/\\b/g, "\b");
  14659. value = value.replace(/\\t/g, "\t");
  14660. value = value.replace(/\\n/g, "\n");
  14661. value = value.replace(/\\r/g, "\r");
  14662. value = value.replace(/\\\"/g, "\"");
  14663. value = value.replace(/\\\'/g, "\'");
  14664. value = value.replace(/\\\\/g, "\\");
  14665. return value;
  14666. }
  14667. function toReal(value) {
  14668. return new _decimal2.default(value);
  14669. }
  14670. function toBool(str) {
  14671. var val = "'" + str + "'";
  14672. var lexer = _languageService.LanguageService.getCurrentLexer();
  14673. var instance = new lexer(null);
  14674. if (instance.literalNames[lexer.RK_TRUE] === val) {
  14675. return true;
  14676. } else if (instance.literalNames[lexer.RK_FALSE] === val) {
  14677. return false;
  14678. } else {
  14679. // TODO: better error message
  14680. throw new Error(str + "not a valid boolean");
  14681. }
  14682. }
  14683. function convertBoolToString(bool) {
  14684. var lexer = _languageService.LanguageService.getCurrentLexer();
  14685. var instance = new lexer(null);
  14686. if (bool) {
  14687. return instance.literalNames[lexer.RK_TRUE];
  14688. } else {
  14689. return instance.literalNames[lexer.RK_FALSE];
  14690. }
  14691. }
  14692. function convertToString(value, type) {
  14693. switch (type.ord) {
  14694. case _types.Types.INTEGER.ord:
  14695. return value.toString();
  14696. case _types.Types.REAL.ord:
  14697. {
  14698. if (value.dp() <= 0) {
  14699. return value.toFixed(1);
  14700. } else {
  14701. return value.toNumber();
  14702. }
  14703. }
  14704. case _types.Types.BOOLEAN.ord:
  14705. return convertBoolToString(value);
  14706. default:
  14707. return value;
  14708. }
  14709. }
  14710. /***/ }),
  14711. /***/ "./js/typeSystem/type.js":
  14712. /*!*******************************!*\
  14713. !*** ./js/typeSystem/type.js ***!
  14714. \*******************************/
  14715. /*! no static exports found */
  14716. /***/ (function(module, exports, __webpack_require__) {
  14717. "use strict";
  14718. Object.defineProperty(exports, "__esModule", {
  14719. value: true
  14720. });
  14721. exports.Type = undefined;
  14722. 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; }; }();
  14723. var _config = __webpack_require__(/*! ../util/config */ "./js/util/config.js");
  14724. var _baseTypes = __webpack_require__(/*! ./baseTypes */ "./js/typeSystem/baseTypes.js");
  14725. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  14726. var Type = exports.Type = function () {
  14727. function Type(baseType) {
  14728. _classCallCheck(this, Type);
  14729. this.baseType = baseType;
  14730. }
  14731. _createClass(Type, [{
  14732. key: "stringInfo",
  14733. value: function stringInfo() {
  14734. return [{ type: this.baseType.name, dim: 0 }];
  14735. }
  14736. }, {
  14737. key: "isCompatible",
  14738. value: function isCompatible(another) {
  14739. if (another instanceof Type) {
  14740. return this.baseType.isCompatible(another.baseType);
  14741. }
  14742. return false;
  14743. }
  14744. }, {
  14745. key: "value",
  14746. get: function get() {
  14747. return this.baseType.value;
  14748. }
  14749. }, {
  14750. key: "ord",
  14751. get: function get() {
  14752. return this.baseType.ord;
  14753. }
  14754. }]);
  14755. return Type;
  14756. }();
  14757. /***/ }),
  14758. /***/ "./js/typeSystem/types.js":
  14759. /*!********************************!*\
  14760. !*** ./js/typeSystem/types.js ***!
  14761. \********************************/
  14762. /*! no static exports found */
  14763. /***/ (function(module, exports, __webpack_require__) {
  14764. "use strict";
  14765. Object.defineProperty(exports, "__esModule", {
  14766. value: true
  14767. });
  14768. exports.Types = undefined;
  14769. var _baseTypes = __webpack_require__(/*! ./baseTypes */ "./js/typeSystem/baseTypes.js");
  14770. var _type = __webpack_require__(/*! ./type */ "./js/typeSystem/type.js");
  14771. var _multiType = __webpack_require__(/*! ./multiType */ "./js/typeSystem/multiType.js");
  14772. var INTEGER = new _type.Type(_baseTypes.BaseTypes.INTEGER);
  14773. var REAL = new _type.Type(_baseTypes.BaseTypes.REAL);
  14774. var STRING = new _type.Type(_baseTypes.BaseTypes.STRING);
  14775. var BOOLEAN = new _type.Type(_baseTypes.BaseTypes.BOOLEAN);
  14776. var VOID = new _type.Type(_baseTypes.BaseTypes.VOID);
  14777. var UNDEFINED = new _type.Type(_baseTypes.BaseTypes.UNDEFINED);
  14778. var ALL = new _multiType.MultiType([INTEGER, REAL, STRING, BOOLEAN]);
  14779. var Types = exports.Types = Object.freeze({
  14780. INTEGER: INTEGER,
  14781. REAL: REAL,
  14782. STRING: STRING,
  14783. BOOLEAN: BOOLEAN,
  14784. VOID: VOID,
  14785. UNDEFINED: UNDEFINED,
  14786. ALL: ALL
  14787. });
  14788. /***/ }),
  14789. /***/ "./js/util/config.js":
  14790. /*!***************************!*\
  14791. !*** ./js/util/config.js ***!
  14792. \***************************/
  14793. /*! no static exports found */
  14794. /***/ (function(module, exports, __webpack_require__) {
  14795. "use strict";
  14796. Object.defineProperty(exports, "__esModule", {
  14797. value: true
  14798. });
  14799. 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; }; }();
  14800. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  14801. var ConfigObject = function () {
  14802. function ConfigObject() {
  14803. _classCallCheck(this, ConfigObject);
  14804. this.loopTimeout = 5000;
  14805. this.decimalPlaces = 5;
  14806. this.intConvertRoundMode = 2;
  14807. this.default_lang = 'pt';
  14808. this.enable_type_casting = true;
  14809. }
  14810. _createClass(ConfigObject, [{
  14811. key: 'setConfig',
  14812. value: function setConfig(opts) {
  14813. for (var key in opts) {
  14814. if (this.hasOwnProperty(key)) {
  14815. this[key] = opts[key];
  14816. }
  14817. }
  14818. }
  14819. }]);
  14820. return ConfigObject;
  14821. }();
  14822. var config = new ConfigObject();
  14823. var Config = exports.Config = config;
  14824. /***/ }),
  14825. /***/ "./js/util/inputTest.js":
  14826. /*!******************************!*\
  14827. !*** ./js/util/inputTest.js ***!
  14828. \******************************/
  14829. /*! no static exports found */
  14830. /***/ (function(module, exports, __webpack_require__) {
  14831. "use strict";
  14832. Object.defineProperty(exports, "__esModule", {
  14833. value: true
  14834. });
  14835. exports.InputTest = undefined;
  14836. 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; }; }();
  14837. var _input = __webpack_require__(/*! ./../io/input */ "./js/io/input.js");
  14838. var _localizedStringsService = __webpack_require__(/*! ../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  14839. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  14840. 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; }
  14841. 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; }
  14842. var InputTest = exports.InputTest = function (_Input) {
  14843. _inherits(InputTest, _Input);
  14844. function InputTest(inputList) {
  14845. _classCallCheck(this, InputTest);
  14846. var _this = _possibleConstructorReturn(this, (InputTest.__proto__ || Object.getPrototypeOf(InputTest)).call(this));
  14847. _this.index = 0;
  14848. _this.inputList = inputList;
  14849. return _this;
  14850. }
  14851. _createClass(InputTest, [{
  14852. key: 'requestInput',
  14853. value: function requestInput(callback) {
  14854. if (this.index < this.inputList.length) {
  14855. callback(this.inputList[this.index]);
  14856. this.index++;
  14857. } else {
  14858. throw new Error(_localizedStringsService.LocalizedStrings.getError("exceeded_input_request"));
  14859. }
  14860. }
  14861. }]);
  14862. return InputTest;
  14863. }(_input.Input);
  14864. /***/ }),
  14865. /***/ "./js/util/outputTest.js":
  14866. /*!*******************************!*\
  14867. !*** ./js/util/outputTest.js ***!
  14868. \*******************************/
  14869. /*! no static exports found */
  14870. /***/ (function(module, exports, __webpack_require__) {
  14871. "use strict";
  14872. Object.defineProperty(exports, "__esModule", {
  14873. value: true
  14874. });
  14875. exports.OutputTest = undefined;
  14876. 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; }; }();
  14877. var _output = __webpack_require__(/*! ./../io/output */ "./js/io/output.js");
  14878. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  14879. 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; }
  14880. 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; }
  14881. var OutputTest = exports.OutputTest = function (_Output) {
  14882. _inherits(OutputTest, _Output);
  14883. function OutputTest() {
  14884. _classCallCheck(this, OutputTest);
  14885. var _this = _possibleConstructorReturn(this, (OutputTest.__proto__ || Object.getPrototypeOf(OutputTest)).call(this));
  14886. _this.list = [];
  14887. return _this;
  14888. }
  14889. _createClass(OutputTest, [{
  14890. key: 'sendOutput',
  14891. value: function sendOutput(text) {
  14892. this.list.push(text);
  14893. }
  14894. }]);
  14895. return OutputTest;
  14896. }(_output.Output);
  14897. /***/ }),
  14898. /***/ "./js/visualUI/algorithm.js":
  14899. /*!**********************************!*\
  14900. !*** ./js/visualUI/algorithm.js ***!
  14901. \**********************************/
  14902. /*! no static exports found */
  14903. /***/ (function(module, exports, __webpack_require__) {
  14904. "use strict";
  14905. Object.defineProperty(exports, "__esModule", {
  14906. value: true
  14907. });
  14908. exports.renderAlgorithm = renderAlgorithm;
  14909. var _jquery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  14910. var _jquery2 = _interopRequireDefault(_jquery);
  14911. var _types = __webpack_require__(/*! ./types */ "./js/visualUI/types.js");
  14912. var _ivprog_elements = __webpack_require__(/*! ./ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  14913. var Models = _interopRequireWildcard(_ivprog_elements);
  14914. var _localizedStringsService = __webpack_require__(/*! ./../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  14915. var _globals = __webpack_require__(/*! ./globals */ "./js/visualUI/globals.js");
  14916. var GlobalsManagement = _interopRequireWildcard(_globals);
  14917. var _variables = __webpack_require__(/*! ./variables */ "./js/visualUI/variables.js");
  14918. var VariablesManagement = _interopRequireWildcard(_variables);
  14919. var _commands = __webpack_require__(/*! ./commands */ "./js/visualUI/commands.js");
  14920. var CommandsManagement = _interopRequireWildcard(_commands);
  14921. var _code_generator = __webpack_require__(/*! ./code_generator */ "./js/visualUI/code_generator.js");
  14922. var CodeManagement = _interopRequireWildcard(_code_generator);
  14923. var _variable_value_menu = __webpack_require__(/*! ./commands/variable_value_menu */ "./js/visualUI/commands/variable_value_menu.js");
  14924. var VariableValueMenu = _interopRequireWildcard(_variable_value_menu);
  14925. var _functions = __webpack_require__(/*! ./functions */ "./js/visualUI/functions.js");
  14926. var FunctionsManagement = _interopRequireWildcard(_functions);
  14927. var _domConsole = __webpack_require__(/*! ./../io/domConsole */ "./js/io/domConsole.js");
  14928. var _ivprogParser = __webpack_require__(/*! ./../ast/ivprogParser */ "./js/ast/ivprogParser.js");
  14929. var _ivprogProcessor = __webpack_require__(/*! ./../processor/ivprogProcessor */ "./js/processor/ivprogProcessor.js");
  14930. var _languageService = __webpack_require__(/*! ../services/languageService */ "./js/services/languageService.js");
  14931. 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; } }
  14932. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  14933. window.block_render = false;
  14934. function renderAlgorithm() {
  14935. if (window.block_render) {
  14936. return;
  14937. }
  14938. if (window.draging) {
  14939. return;
  14940. }
  14941. window.block_render = true;
  14942. console.log('rendering algorithm');
  14943. (0, _jquery2.default)('.all_functions').children().off();
  14944. (0, _jquery2.default)('.all_functions').empty();
  14945. (0, _jquery2.default)('.list_globals').children().off();
  14946. (0, _jquery2.default)('.list_globals').empty();
  14947. for (var i = 0; i < window.program_obj.functions.length; i++) {
  14948. FunctionsManagement.renderFunction(window.program_obj.functions[i]);
  14949. }
  14950. for (var i = 0; i < window.program_obj.globals.length; i++) {
  14951. GlobalsManagement.renderGlobal(window.program_obj.globals[i]);
  14952. }
  14953. setTimeout(function () {
  14954. window.block_render = false;
  14955. }, 500);
  14956. }
  14957. /***/ }),
  14958. /***/ "./js/visualUI/code_generator.js":
  14959. /*!***************************************!*\
  14960. !*** ./js/visualUI/code_generator.js ***!
  14961. \***************************************/
  14962. /*! no static exports found */
  14963. /***/ (function(module, exports, __webpack_require__) {
  14964. "use strict";
  14965. Object.defineProperty(exports, "__esModule", {
  14966. value: true
  14967. });
  14968. exports.generate = generate;
  14969. var _jquery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  14970. var _jquery2 = _interopRequireDefault(_jquery);
  14971. var _types = __webpack_require__(/*! ./types */ "./js/visualUI/types.js");
  14972. var _ivprog_elements = __webpack_require__(/*! ./ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  14973. var Models = _interopRequireWildcard(_ivprog_elements);
  14974. var _localizedStringsService = __webpack_require__(/*! ./../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  14975. var _globals = __webpack_require__(/*! ./globals */ "./js/visualUI/globals.js");
  14976. var GlobalsManagement = _interopRequireWildcard(_globals);
  14977. var _variables = __webpack_require__(/*! ./variables */ "./js/visualUI/variables.js");
  14978. var VariablesManagement = _interopRequireWildcard(_variables);
  14979. var _commands = __webpack_require__(/*! ./commands */ "./js/visualUI/commands.js");
  14980. var CommandsManagement = _interopRequireWildcard(_commands);
  14981. var _utils = __webpack_require__(/*! ./utils */ "./js/visualUI/utils.js");
  14982. var Utils = _interopRequireWildcard(_utils);
  14983. 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; } }
  14984. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  14985. function generate() {
  14986. (0, _jquery2.default)('.ivprog_visual_panel').find('.error_icon').remove();
  14987. var code = _localizedStringsService.LocalizedStrings.getUI('program') + ' { ';
  14988. code += globalsCode();
  14989. code += '\n';
  14990. var has_error = false;
  14991. for (var i = 0; i < window.program_obj.functions.length; i++) {
  14992. var n_code = functionsCode(window.program_obj.functions[i]);
  14993. if (n_code == null) {
  14994. has_error = true;
  14995. }
  14996. code += n_code;
  14997. code += '\n';
  14998. }
  14999. code += '\n}';
  15000. if (has_error) {
  15001. return null;
  15002. } else {
  15003. return code;
  15004. }
  15005. }
  15006. function functionsCode(function_obj) {
  15007. var ret = '\n\t' + _localizedStringsService.LocalizedStrings.getUI('function') + ' ';
  15008. var has_error = false;
  15009. switch (function_obj.return_type) {
  15010. case _types.Types.INTEGER:
  15011. ret += _localizedStringsService.LocalizedStrings.getUI('integer');
  15012. break;
  15013. case _types.Types.REAL:
  15014. ret += _localizedStringsService.LocalizedStrings.getUI('real');
  15015. break;
  15016. case _types.Types.TEXT:
  15017. ret += _localizedStringsService.LocalizedStrings.getUI('text');
  15018. break;
  15019. case _types.Types.BOOLEAN:
  15020. ret += _localizedStringsService.LocalizedStrings.getUI('boolean');
  15021. break;
  15022. case _types.Types.VOID:
  15023. ret += _localizedStringsService.LocalizedStrings.getUI('void');
  15024. break;
  15025. }
  15026. ret += ' ';
  15027. if (function_obj.return_dimensions == 1) {
  15028. ret += '[] ';
  15029. } else if (function_obj.return_dimensions == 2) {
  15030. ret += '[][] ';
  15031. }
  15032. ret += function_obj.name + ' ( ';
  15033. for (var j = 0; j < function_obj.parameters_list.length; j++) {
  15034. ret += parametersCode(function_obj.parameters_list[j]);
  15035. if (j + 1 < function_obj.parameters_list.length) {
  15036. ret += ',';
  15037. }
  15038. }
  15039. ret += ' ) {';
  15040. for (var j = 0; j < function_obj.variables_list.length; j++) {
  15041. ret += variablesCode(function_obj.variables_list[j]);
  15042. }
  15043. for (var j = 0; j < function_obj.commands.length; j++) {
  15044. try {
  15045. ret += commandsCode(function_obj.commands[j]);
  15046. } catch (err) {
  15047. has_error = true;
  15048. console.error(err.message);
  15049. var todos = (0, _jquery2.default)('body').find('.command_container');
  15050. for (var i = 0; i < todos.length; i++) {
  15051. if ((0, _jquery2.default)(todos[i]).data('command') == function_obj.commands[j]) {
  15052. (0, _jquery2.default)(todos[i]).prepend(' <i class="ui icon red exclamation triangle error_icon"></i> ');
  15053. break;
  15054. }
  15055. }
  15056. }
  15057. }
  15058. ret += '\n\t}';
  15059. if (has_error) {
  15060. return null;
  15061. } else {
  15062. return ret;
  15063. }
  15064. }
  15065. function commandsCode(command_obj) {
  15066. var indentation = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 2;
  15067. switch (command_obj.type) {
  15068. case Models.COMMAND_TYPES.break:
  15069. return breaksCode(command_obj, indentation);
  15070. case Models.COMMAND_TYPES.comment:
  15071. return commentsCode(command_obj, indentation);
  15072. case Models.COMMAND_TYPES.reader:
  15073. return readersCode(command_obj, indentation);
  15074. case Models.COMMAND_TYPES.writer:
  15075. return writersCode(command_obj, indentation);
  15076. case Models.COMMAND_TYPES.functioncall:
  15077. return functioncallsCode(command_obj, indentation);
  15078. case Models.COMMAND_TYPES.attribution:
  15079. return attributionsCode(command_obj, indentation);
  15080. case Models.COMMAND_TYPES.whiletrue:
  15081. return whiletruesCode(command_obj, indentation);
  15082. case Models.COMMAND_TYPES.dowhiletrue:
  15083. return doWhilesCode(command_obj, indentation);
  15084. case Models.COMMAND_TYPES.iftrue:
  15085. return iftruesCode(command_obj, indentation);
  15086. case Models.COMMAND_TYPES.repeatNtimes:
  15087. return repeatNtimesCode(command_obj, indentation);
  15088. case Models.COMMAND_TYPES.switch:
  15089. return switchsCode(command_obj, indentation);
  15090. case Models.COMMAND_TYPES.return:
  15091. return returnsCode(command_obj, indentation);
  15092. }
  15093. }
  15094. function returnsCode(command_obj, indentation) {
  15095. var ret = '\n';
  15096. for (var i = 0; i < indentation; i++) {
  15097. ret += '\t';
  15098. }
  15099. ret += _localizedStringsService.LocalizedStrings.getUI('text_return');
  15100. if (command_obj.variable_value_menu) {
  15101. try {
  15102. ret += ' ' + variableValueMenuCode(command_obj.variable_value_menu, true);
  15103. } catch (err) {}
  15104. }
  15105. return ret;
  15106. }
  15107. function breaksCode(command_obj, indentation) {
  15108. var ret = '\n';
  15109. for (var i = 0; i < indentation; i++) {
  15110. ret += '\t';
  15111. }
  15112. ret += _localizedStringsService.LocalizedStrings.getUI('text_break');
  15113. return ret;
  15114. }
  15115. function switchsCode(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_switch') + ' ( ';
  15121. ret += variableValueMenuCode(command_obj.variable);
  15122. ret += ' ) { ';
  15123. if (command_obj.cases) {
  15124. for (var i = 0; i < command_obj.cases.length; i++) {
  15125. ret += switchcasesCode(command_obj.cases[i], indentation + 1);
  15126. }
  15127. }
  15128. ret += '\n';
  15129. for (var i = 0; i < indentation; i++) {
  15130. ret += '\t';
  15131. }
  15132. ret += '} ';
  15133. return ret;
  15134. }
  15135. function switchcasesCode(switchcase, indentation) {
  15136. var ret = '\n';
  15137. for (var i = 0; i < indentation; i++) {
  15138. ret += '\t';
  15139. }
  15140. ret += _localizedStringsService.LocalizedStrings.getUI('text_code_case') + ' ';
  15141. ret += variableValueMenuCode(switchcase.variable_value_menu);
  15142. ret += ' :';
  15143. if (switchcase.commands_block) {
  15144. for (var i = 0; i < switchcase.commands_block.length; i++) {
  15145. ret += commandsCode(switchcase.commands_block[i], indentation + 1);
  15146. }
  15147. }
  15148. return ret;
  15149. }
  15150. function repeatNtimesCode(command_obj, indentation) {
  15151. var ret = '\n';
  15152. for (var i = 0; i < indentation; i++) {
  15153. ret += '\t';
  15154. }
  15155. ret += _localizedStringsService.LocalizedStrings.getUI('text_for') + ' ( ';
  15156. if (command_obj.var_attribution) {
  15157. ret += variableValueMenuCode(command_obj.var_attribution);
  15158. ret += ' = ';
  15159. ret += variableValueMenuCode(command_obj.expression1);
  15160. }
  15161. ret += ' ; ';
  15162. if (command_obj.expression2) {
  15163. switch (command_obj.expression2.expression.type) {
  15164. case Models.EXPRESSION_TYPES.exp_logic:
  15165. ret += logicExpressionCode(command_obj.expression2.expression);
  15166. break;
  15167. case Models.EXPRESSION_TYPES.exp_arithmetic:
  15168. ret += arithmeticExpressionCode(command_obj.expression2.expression);
  15169. break;
  15170. }
  15171. }
  15172. ret += ' ; ';
  15173. if (command_obj.var_incrementation) {
  15174. ret += variableValueMenuCode(command_obj.var_incrementation);
  15175. ret += ' = ';
  15176. ret += variableValueMenuCode(command_obj.expression3.itens[0]);
  15177. switch (command_obj.expression3.itens[1]) {
  15178. case Models.ARITHMETIC_TYPES.plus:
  15179. ret += ' + ';
  15180. break;
  15181. case Models.ARITHMETIC_TYPES.minus:
  15182. ret += ' - ';
  15183. break;
  15184. case Models.ARITHMETIC_TYPES.multiplication:
  15185. ret += ' * ';
  15186. break;
  15187. case Models.ARITHMETIC_TYPES.division:
  15188. ret += ' / ';
  15189. break;
  15190. case Models.ARITHMETIC_TYPES.module:
  15191. ret += ' % ';
  15192. break;
  15193. }
  15194. ret += variableValueMenuCode(command_obj.expression3.itens[2]);
  15195. }
  15196. ret += ' ) { ';
  15197. if (command_obj.commands_block) {
  15198. for (var i = 0; i < command_obj.commands_block.length; i++) {
  15199. ret += commandsCode(command_obj.commands_block[i], indentation + 1);
  15200. }
  15201. }
  15202. ret += '\n';
  15203. for (var i = 0; i < indentation; i++) {
  15204. ret += '\t';
  15205. }
  15206. ret += '}';
  15207. return ret;
  15208. }
  15209. function iftruesCode(command_obj, indentation) {
  15210. var ret = '\n';
  15211. for (var i = 0; i < indentation; i++) {
  15212. ret += '\t';
  15213. }
  15214. ret += _localizedStringsService.LocalizedStrings.getUI('text_if');
  15215. if (!command_obj.expression.expression) {
  15216. Utils.renderErrorMessage(command_obj.expression.dom_object, _localizedStringsService.LocalizedStrings.getUI('inform_valid_expression'));
  15217. }
  15218. switch (command_obj.expression.expression.type) {
  15219. case Models.EXPRESSION_TYPES.exp_logic:
  15220. ret += logicExpressionCode(command_obj.expression.expression);
  15221. break;
  15222. case Models.EXPRESSION_TYPES.exp_arithmetic:
  15223. ret += arithmeticExpressionCode(command_obj.expression.expression);
  15224. break;
  15225. }
  15226. ret += ' { ';
  15227. if (command_obj.commands_block) {
  15228. for (var i = 0; i < command_obj.commands_block.length; i++) {
  15229. ret += commandsCode(command_obj.commands_block[i], indentation + 1);
  15230. }
  15231. }
  15232. ret += '\n';
  15233. for (var i = 0; i < indentation; i++) {
  15234. ret += '\t';
  15235. }
  15236. ret += '} ' + _localizedStringsService.LocalizedStrings.getUI('text_else') + ' {';
  15237. if (command_obj.commands_else) {
  15238. for (var i = 0; i < command_obj.commands_else.length; i++) {
  15239. ret += commandsCode(command_obj.commands_else[i], indentation + 1);
  15240. }
  15241. }
  15242. ret += '\n';
  15243. for (var i = 0; i < indentation; i++) {
  15244. ret += '\t';
  15245. }
  15246. ret += '}';
  15247. return ret;
  15248. }
  15249. function doWhilesCode(command_obj, indentation) {
  15250. var ret = '\n';
  15251. for (var i = 0; i < indentation; i++) {
  15252. ret += '\t';
  15253. }
  15254. ret += _localizedStringsService.LocalizedStrings.getUI('text_code_do') + ' { ';
  15255. if (command_obj.commands_block) {
  15256. for (var i = 0; i < command_obj.commands_block.length; i++) {
  15257. ret += commandsCode(command_obj.commands_block[i], indentation + 1);
  15258. }
  15259. }
  15260. ret += '\n';
  15261. for (var i = 0; i < indentation; i++) {
  15262. ret += '\t';
  15263. }
  15264. ret += '} ' + _localizedStringsService.LocalizedStrings.getUI('text_code_while');
  15265. if (!command_obj.expression.expression) {
  15266. Utils.renderErrorMessage(command_obj.expression.dom_object, _localizedStringsService.LocalizedStrings.getUI('inform_valid_expression'));
  15267. }
  15268. switch (command_obj.expression.expression.type) {
  15269. case Models.EXPRESSION_TYPES.exp_logic:
  15270. ret += logicExpressionCode(command_obj.expression.expression);
  15271. break;
  15272. case Models.EXPRESSION_TYPES.exp_arithmetic:
  15273. ret += arithmeticExpressionCode(command_obj.expression.expression);
  15274. break;
  15275. }
  15276. return ret;
  15277. }
  15278. function whiletruesCode(command_obj, indentation) {
  15279. var ret = '\n';
  15280. for (var i = 0; i < indentation; i++) {
  15281. ret += '\t';
  15282. }
  15283. ret += _localizedStringsService.LocalizedStrings.getUI('text_code_while');
  15284. if (!command_obj.expression.expression) {
  15285. Utils.renderErrorMessage(command_obj.expression.dom_object, _localizedStringsService.LocalizedStrings.getUI('inform_valid_expression'));
  15286. }
  15287. switch (command_obj.expression.expression.type) {
  15288. case Models.EXPRESSION_TYPES.exp_logic:
  15289. ret += logicExpressionCode(command_obj.expression.expression);
  15290. break;
  15291. case Models.EXPRESSION_TYPES.exp_arithmetic:
  15292. ret += arithmeticExpressionCode(command_obj.expression.expression);
  15293. break;
  15294. }
  15295. ret += ' { ';
  15296. if (command_obj.commands_block) {
  15297. for (var i = 0; i < command_obj.commands_block.length; i++) {
  15298. ret += commandsCode(command_obj.commands_block[i], indentation + 1);
  15299. }
  15300. }
  15301. ret += '\n';
  15302. for (var i = 0; i < indentation; i++) {
  15303. ret += '\t';
  15304. }
  15305. ret += '}';
  15306. return ret;
  15307. }
  15308. function logicExpressionCode(expression) {
  15309. var ret = ' ( ';
  15310. if (expression.first_operand.type == Models.EXPRESSION_TYPES.exp_logic) {
  15311. ret += logicExpressionCode(expression.first_operand);
  15312. } else if (expression.first_operand.type == Models.EXPRESSION_TYPES.exp_arithmetic) {
  15313. ret += arithmeticExpressionCode(expression.first_operand);
  15314. } else {
  15315. ret += variableValueMenuCode(expression.first_operand);
  15316. }
  15317. if (expression.operator) {
  15318. switch (expression.operator) {
  15319. case Models.LOGIC_COMPARISON.equals_to:
  15320. ret += ' == ';
  15321. break;
  15322. case Models.LOGIC_COMPARISON.not_equals_to:
  15323. ret += ' != ';
  15324. break;
  15325. case Models.LOGIC_COMPARISON.and:
  15326. ret += ' && ';
  15327. break;
  15328. case Models.LOGIC_COMPARISON.or:
  15329. ret += ' || ';
  15330. break;
  15331. }
  15332. if (expression.second_operand.type == Models.EXPRESSION_TYPES.exp_logic) {
  15333. ret += logicExpressionCode(expression.second_operand);
  15334. } else if (expression.second_operand.type == Models.EXPRESSION_TYPES.exp_arithmetic) {
  15335. ret += arithmeticExpressionCode(expression.second_operand);
  15336. } else {
  15337. ret += variableValueMenuCode(expression.second_operand);
  15338. }
  15339. }
  15340. ret += ' ) ';
  15341. return ret;
  15342. }
  15343. function arithmeticExpressionCode(expression) {
  15344. var ret = ' ( ';
  15345. if (expression.first_operand.type == Models.EXPRESSION_TYPES.exp_logic) {
  15346. ret += logicExpressionCode(expression.first_operand);
  15347. } else if (expression.first_operand.type == Models.EXPRESSION_TYPES.exp_arithmetic) {
  15348. ret += arithmeticExpressionCode(expression.first_operand);
  15349. } else {
  15350. ret += variableValueMenuCode(expression.first_operand);
  15351. }
  15352. switch (expression.operator) {
  15353. case Models.ARITHMETIC_COMPARISON.greater_than:
  15354. ret += ' > ';
  15355. break;
  15356. case Models.ARITHMETIC_COMPARISON.less_than:
  15357. ret += ' < ';
  15358. break;
  15359. case Models.ARITHMETIC_COMPARISON.equals_to:
  15360. ret += ' == ';
  15361. break;
  15362. case Models.ARITHMETIC_COMPARISON.not_equals_to:
  15363. ret += ' != ';
  15364. break;
  15365. case Models.ARITHMETIC_COMPARISON.greater_than_or_equals_to:
  15366. ret += ' >= ';
  15367. break;
  15368. case Models.ARITHMETIC_COMPARISON.less_than_or_equals_to:
  15369. ret += ' <= ';
  15370. break;
  15371. }
  15372. if (expression.second_operand.type == Models.EXPRESSION_TYPES.exp_logic) {
  15373. ret += logicExpressionCode(expression.second_operand);
  15374. } else if (expression.second_operand.type == Models.EXPRESSION_TYPES.exp_arithmetic) {
  15375. ret += arithmeticExpressionCode(expression.second_operand);
  15376. } else {
  15377. ret += variableValueMenuCode(expression.second_operand);
  15378. }
  15379. ret += ' ) ';
  15380. return ret;
  15381. }
  15382. function attributionsCode(command_obj, indentation) {
  15383. var ret = '\n';
  15384. for (var i = 0; i < indentation; i++) {
  15385. ret += '\t';
  15386. }
  15387. ret += variableValueMenuCode(command_obj.variable) + ' = ';
  15388. for (var i = 0; i < command_obj.expression.length; i++) {
  15389. ret += elementExpressionCode(command_obj.expression[i]);
  15390. }
  15391. return ret;
  15392. }
  15393. function elementExpressionCode(expression_obj) {
  15394. var ret = '';
  15395. for (var i = 0; i < expression_obj.itens.length; i++) {
  15396. if (expression_obj.itens[i].type) {
  15397. ret += variableValueMenuCode(expression_obj.itens[i]);
  15398. } else if (expression_obj.itens[i].type_exp) {
  15399. if (expression_obj.itens[i].type_exp == Models.EXPRESSION_ELEMENTS.par_exp_par) {
  15400. ret += ' ( ';
  15401. }
  15402. ret += elementExpressionCode(expression_obj.itens[i]);
  15403. if (expression_obj.itens[i].type_exp == Models.EXPRESSION_ELEMENTS.par_exp_par) {
  15404. ret += ' ) ';
  15405. }
  15406. } else {
  15407. switch (expression_obj.itens[i]) {
  15408. case Models.ARITHMETIC_TYPES.plus:
  15409. ret += ' + ';
  15410. break;
  15411. case Models.ARITHMETIC_TYPES.minus:
  15412. ret += ' - ';
  15413. break;
  15414. case Models.ARITHMETIC_TYPES.multiplication:
  15415. ret += ' * ';
  15416. break;
  15417. case Models.ARITHMETIC_TYPES.division:
  15418. ret += ' / ';
  15419. break;
  15420. case Models.ARITHMETIC_TYPES.module:
  15421. ret += ' % ';
  15422. break;
  15423. }
  15424. }
  15425. }
  15426. return ret;
  15427. }
  15428. function functioncallsCode(command_obj, indentation) {
  15429. var ret = '\n';
  15430. for (var i = 0; i < indentation; i++) {
  15431. ret += '\t';
  15432. }
  15433. ret += variableValueMenuCode(command_obj.function_called);
  15434. return ret;
  15435. }
  15436. function readersCode(command_obj, indentation) {
  15437. var ret = '\n';
  15438. for (var i = 0; i < indentation; i++) {
  15439. ret += '\t';
  15440. }
  15441. ret += _localizedStringsService.LocalizedStrings.getUI('text_command_read') + ' ( ';
  15442. ret += variableValueMenuCode(command_obj.variable_value_menu);
  15443. ret += ' ) ';
  15444. return ret;
  15445. }
  15446. function variableValueMenuCode(variable_obj) {
  15447. var is_return = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  15448. var ret = '';
  15449. try {
  15450. if (variable_obj.function_called) {
  15451. if (variable_obj.function_called.name) {
  15452. ret += variable_obj.function_called.name + ' ( ';
  15453. } else {
  15454. ret += _localizedStringsService.LocalizedStrings.getUI(variable_obj.function_called.category) + '.' + _localizedStringsService.LocalizedStrings.getUI(variable_obj.function_called.identifier) + ' ( ';
  15455. }
  15456. if (variable_obj.parameters_list) {
  15457. for (var i = 0; i < variable_obj.parameters_list.length; i++) {
  15458. ret += variableValueMenuCode(variable_obj.parameters_list[i]);
  15459. if (i + 1 < variable_obj.parameters_list.length) {
  15460. ret += ', ';
  15461. }
  15462. }
  15463. }
  15464. ret += ' )';
  15465. } else if (variable_obj.content.type) {
  15466. ret += variable_obj.content.name;
  15467. if (variable_obj.content.dimensions == 1 && variable_obj.dimensions != 1) {
  15468. ret += ' [ ' + variableValueMenuCode(variable_obj.column) + ' ] ';
  15469. }
  15470. if (variable_obj.content.dimensions == 2 && variable_obj.dimensions != 2) {
  15471. ret += ' [ ' + variableValueMenuCode(variable_obj.row) + ' ] ';
  15472. ret += ' [ ' + variableValueMenuCode(variable_obj.column) + ' ] ';
  15473. }
  15474. } else {
  15475. if (isNaN(variable_obj.content)) {
  15476. ret += '"' + variable_obj.content + '"';
  15477. } else {
  15478. ret += variable_obj.content;
  15479. }
  15480. }
  15481. } catch (err) {
  15482. if (!is_return) {
  15483. Utils.renderErrorMessage(variable_obj.dom_object, _localizedStringsService.LocalizedStrings.getUI('inform_valid_content'));
  15484. throw err;
  15485. }
  15486. }
  15487. return ret;
  15488. }
  15489. function writersCode(command_obj, indentation) {
  15490. var ret = '\n';
  15491. for (var i = 0; i < indentation; i++) {
  15492. ret += '\t';
  15493. }
  15494. ret += _localizedStringsService.LocalizedStrings.getUI('text_command_write') + ' ( ';
  15495. for (var i = 0; i < command_obj.content.length; i++) {
  15496. ret += variableValueMenuCode(command_obj.content[i]);
  15497. if (i + 1 < command_obj.content.length) {
  15498. ret += ' + ';
  15499. }
  15500. }
  15501. ret += ' ) ';
  15502. return ret;
  15503. }
  15504. function commentsCode(command_obj, indentation) {
  15505. var ret = '\n';
  15506. for (var i = 0; i < indentation; i++) {
  15507. ret += '\t';
  15508. }
  15509. ret += '// ';
  15510. ret += command_obj.comment_text.content;
  15511. return ret;
  15512. }
  15513. function parametersCode(parameter_obj) {
  15514. var ret = '';
  15515. switch (parameter_obj.type) {
  15516. case _types.Types.INTEGER:
  15517. ret += ' ' + _localizedStringsService.LocalizedStrings.getUI('integer') + ' ';
  15518. break;
  15519. case _types.Types.REAL:
  15520. ret += ' ' + _localizedStringsService.LocalizedStrings.getUI('real') + ' ';
  15521. break;
  15522. case _types.Types.TEXT:
  15523. ret += ' ' + _localizedStringsService.LocalizedStrings.getUI('text') + ' ';
  15524. break;
  15525. case _types.Types.BOOLEAN:
  15526. ret += ' ' + _localizedStringsService.LocalizedStrings.getUI('boolean') + ' ';
  15527. break;
  15528. }
  15529. ret += parameter_obj.name + '';
  15530. if (parameter_obj.dimensions == 1) {
  15531. ret += ' []';
  15532. } else if (parameter_obj.dimensions == 2) {
  15533. ret += ' [][]';
  15534. }
  15535. return ret;
  15536. }
  15537. function variablesCode(variable_obj) {
  15538. var ret = '';
  15539. var temp = variable_obj;
  15540. ret += '\n\t\t';
  15541. if (temp.is_constant) {
  15542. ret += 'const ';
  15543. }
  15544. switch (temp.type) {
  15545. case _types.Types.INTEGER:
  15546. ret += _localizedStringsService.LocalizedStrings.getUI('integer') + ' ';
  15547. break;
  15548. case _types.Types.REAL:
  15549. ret += _localizedStringsService.LocalizedStrings.getUI('real') + ' ';
  15550. break;
  15551. case _types.Types.TEXT:
  15552. ret += _localizedStringsService.LocalizedStrings.getUI('text') + ' ';
  15553. break;
  15554. case _types.Types.BOOLEAN:
  15555. ret += _localizedStringsService.LocalizedStrings.getUI('boolean') + ' ';
  15556. break;
  15557. }
  15558. ret += temp.name + ' ';
  15559. if (temp.dimensions == 1) {
  15560. ret += '[' + temp.columns + '] ';
  15561. switch (temp.type) {
  15562. case _types.Types.INTEGER:
  15563. ret += '= {' + temp.value + '}';
  15564. break;
  15565. case _types.Types.REAL:
  15566. ret += '= {' + temp.value.toFixed(2) + '}';
  15567. break;
  15568. case _types.Types.TEXT:
  15569. ret += '= {';
  15570. for (var j = 0; j < temp.value.length; j++) {
  15571. ret += '"' + temp.value[j] + '"';
  15572. if (j + 1 < temp.value.length) {
  15573. ret += ',';
  15574. }
  15575. }
  15576. ret += '}';
  15577. break;
  15578. case _types.Types.BOOLEAN:
  15579. ret += '= {';
  15580. for (var j = 0; j < temp.value.length; j++) {
  15581. if (temp.value[j]) {
  15582. ret += _localizedStringsService.LocalizedStrings.getUI("true");
  15583. } else {
  15584. ret += _localizedStringsService.LocalizedStrings.getUI("false");
  15585. }
  15586. if (j + 1 < temp.value.length) {
  15587. ret += ',';
  15588. }
  15589. }
  15590. ret += '}';
  15591. break;
  15592. }
  15593. } else if (temp.dimensions == 2) {
  15594. ret += '[' + temp.rows + '][' + temp.columns + '] ';
  15595. switch (temp.type) {
  15596. case _types.Types.INTEGER:
  15597. ret += '= {';
  15598. for (var j = 0; j < temp.rows; j++) {
  15599. ret += '{' + temp.value[j] + '}';
  15600. if (j + 1 < temp.rows) {
  15601. ret += ',';
  15602. }
  15603. }
  15604. ret += '}';
  15605. break;
  15606. case _types.Types.REAL:
  15607. ret += '= {';
  15608. for (var j = 0; j < temp.rows; j++) {
  15609. ret += '{' + temp.value[j].toFixed(2) + '}';
  15610. if (j + 1 < temp.rows) {
  15611. ret += ',';
  15612. }
  15613. }
  15614. ret += '}';
  15615. break;
  15616. case _types.Types.TEXT:
  15617. ret += '= {';
  15618. for (var j = 0; j < temp.rows; j++) {
  15619. ret += '{';
  15620. for (var k = 0; k < temp.columns; k++) {
  15621. ret += '"' + temp.value[j][k] + '"';
  15622. if (k + 1 < temp.columns) {
  15623. ret += ',';
  15624. }
  15625. }
  15626. ret += '}';
  15627. if (j + 1 < temp.rows) {
  15628. ret += ',';
  15629. }
  15630. }
  15631. ret += '}';
  15632. break;
  15633. case _types.Types.BOOLEAN:
  15634. ret += '= {';
  15635. for (var j = 0; j < temp.rows; j++) {
  15636. ret += '{';
  15637. for (var k = 0; k < temp.columns; k++) {
  15638. if (temp.value[j][k]) {
  15639. ret += _localizedStringsService.LocalizedStrings.getUI("true");
  15640. } else {
  15641. ret += _localizedStringsService.LocalizedStrings.getUI("false");
  15642. }
  15643. if (k + 1 < temp.columns) {
  15644. ret += ',';
  15645. }
  15646. }
  15647. ret += '}';
  15648. if (j + 1 < temp.rows) {
  15649. ret += ',';
  15650. }
  15651. }
  15652. ret += '}';
  15653. break;
  15654. }
  15655. } else {
  15656. switch (temp.type) {
  15657. case _types.Types.INTEGER:
  15658. ret += '= ' + temp.value;
  15659. break;
  15660. case _types.Types.REAL:
  15661. ret += '= ' + temp.value.toFixed(2);
  15662. break;
  15663. case _types.Types.TEXT:
  15664. ret += '= "' + temp.value + '"';
  15665. break;
  15666. case _types.Types.BOOLEAN:
  15667. ret += '= ';
  15668. if (temp.value) {
  15669. ret += _localizedStringsService.LocalizedStrings.getUI("true");
  15670. } else {
  15671. ret += _localizedStringsService.LocalizedStrings.getUI("false");
  15672. }
  15673. break;
  15674. }
  15675. }
  15676. return ret;
  15677. }
  15678. function globalsCode() {
  15679. var ret = '';
  15680. if (window.program_obj.globals) {
  15681. for (var i = 0; i < window.program_obj.globals.length; i++) {
  15682. var temp = window.program_obj.globals[i];
  15683. ret += '\n\t';
  15684. if (temp.is_constant) {
  15685. ret += 'const ';
  15686. }
  15687. switch (temp.type) {
  15688. case _types.Types.INTEGER:
  15689. ret += _localizedStringsService.LocalizedStrings.getUI('integer');
  15690. break;
  15691. case _types.Types.REAL:
  15692. ret += _localizedStringsService.LocalizedStrings.getUI('real');
  15693. break;
  15694. case _types.Types.TEXT:
  15695. ret += _localizedStringsService.LocalizedStrings.getUI('text');
  15696. break;
  15697. case _types.Types.BOOLEAN:
  15698. ret += _localizedStringsService.LocalizedStrings.getUI('boolean');
  15699. break;
  15700. }
  15701. ret += ' ' + temp.name + ' ';
  15702. if (temp.dimensions == 1) {
  15703. ret += '[' + temp.columns + '] ';
  15704. switch (temp.type) {
  15705. case _types.Types.INTEGER:
  15706. ret += '= {' + temp.value + '}';
  15707. break;
  15708. case _types.Types.REAL:
  15709. ret += '= {';
  15710. for (var j = 0; j < temp.value.length; j++) {
  15711. ret += temp.value[j].toFixed(2);
  15712. if (j + 1 < temp.value.length) {
  15713. ret += ',';
  15714. }
  15715. }
  15716. ret += '}';
  15717. break;
  15718. case _types.Types.TEXT:
  15719. ret += '= {';
  15720. for (var j = 0; j < temp.value.length; j++) {
  15721. ret += '"' + temp.value[j] + '"';
  15722. if (j + 1 < temp.value.length) {
  15723. ret += ',';
  15724. }
  15725. }
  15726. ret += '}';
  15727. break;
  15728. case _types.Types.BOOLEAN:
  15729. ret += '= {';
  15730. for (var j = 0; j < temp.value.length; j++) {
  15731. if (temp.value[j]) {
  15732. ret += _localizedStringsService.LocalizedStrings.getUI("true");
  15733. } else {
  15734. ret += _localizedStringsService.LocalizedStrings.getUI("false");
  15735. }
  15736. if (j + 1 < temp.value.length) {
  15737. ret += ',';
  15738. }
  15739. }
  15740. ret += '}';
  15741. break;
  15742. }
  15743. } else if (temp.dimensions == 2) {
  15744. ret += '[' + temp.rows + '][' + temp.columns + '] ';
  15745. switch (temp.type) {
  15746. case _types.Types.INTEGER:
  15747. ret += '= {';
  15748. for (var j = 0; j < temp.rows; j++) {
  15749. ret += '{' + temp.value[j] + '}';
  15750. if (j + 1 < temp.rows) {
  15751. ret += ',';
  15752. }
  15753. }
  15754. ret += '}';
  15755. break;
  15756. case _types.Types.REAL:
  15757. ret += '= {';
  15758. for (var j = 0; j < temp.rows; j++) {
  15759. ret += '{';
  15760. for (var k = 0; k < temp.columns; k++) {
  15761. ret += temp.value[j][k].toFixed(2);
  15762. if (k + 1 < temp.columns) {
  15763. ret += ',';
  15764. }
  15765. }
  15766. ret += '}';
  15767. if (j + 1 < temp.rows) {
  15768. ret += ',';
  15769. }
  15770. }
  15771. ret += '}';
  15772. break;
  15773. case _types.Types.TEXT:
  15774. ret += '= {';
  15775. for (var j = 0; j < temp.rows; j++) {
  15776. ret += '{';
  15777. for (var k = 0; k < temp.columns; k++) {
  15778. ret += '"' + temp.value[j][k] + '"';
  15779. if (k + 1 < temp.columns) {
  15780. ret += ',';
  15781. }
  15782. }
  15783. ret += '}';
  15784. if (j + 1 < temp.rows) {
  15785. ret += ',';
  15786. }
  15787. }
  15788. ret += '}';
  15789. break;
  15790. case _types.Types.BOOLEAN:
  15791. ret += '= {';
  15792. for (var j = 0; j < temp.rows; j++) {
  15793. ret += '{';
  15794. for (var k = 0; k < temp.columns; k++) {
  15795. if (temp.value[j][k]) {
  15796. ret += _localizedStringsService.LocalizedStrings.getUI("true");
  15797. } else {
  15798. ret += _localizedStringsService.LocalizedStrings.getUI("false");
  15799. }
  15800. if (k + 1 < temp.columns) {
  15801. ret += ',';
  15802. }
  15803. }
  15804. ret += '}';
  15805. if (j + 1 < temp.rows) {
  15806. ret += ',';
  15807. }
  15808. }
  15809. ret += '}';
  15810. break;
  15811. }
  15812. } else {
  15813. switch (temp.type) {
  15814. case _types.Types.INTEGER:
  15815. ret += '= ' + temp.value;
  15816. break;
  15817. case _types.Types.REAL:
  15818. ret += '= ' + temp.value.toFixed(2);
  15819. break;
  15820. case _types.Types.TEXT:
  15821. ret += '= "' + temp.value + '"';
  15822. break;
  15823. case _types.Types.BOOLEAN:
  15824. ret += '= ';
  15825. if (temp.value) {
  15826. ret += _localizedStringsService.LocalizedStrings.getUI("true");;
  15827. } else {
  15828. ret += _localizedStringsService.LocalizedStrings.getUI("false");;
  15829. }
  15830. break;
  15831. }
  15832. }
  15833. }
  15834. }
  15835. return ret;
  15836. }
  15837. /***/ }),
  15838. /***/ "./js/visualUI/commands.js":
  15839. /*!*********************************!*\
  15840. !*** ./js/visualUI/commands.js ***!
  15841. \*********************************/
  15842. /*! no static exports found */
  15843. /***/ (function(module, exports, __webpack_require__) {
  15844. "use strict";
  15845. Object.defineProperty(exports, "__esModule", {
  15846. value: true
  15847. });
  15848. exports.removeCommand = removeCommand;
  15849. exports.createFloatingCommand = createFloatingCommand;
  15850. exports.renderCommand = renderCommand;
  15851. exports.genericCreateCommand = genericCreateCommand;
  15852. var _jquery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  15853. var _jquery2 = _interopRequireDefault(_jquery);
  15854. var _types = __webpack_require__(/*! ./types */ "./js/visualUI/types.js");
  15855. var _ivprog_elements = __webpack_require__(/*! ./ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  15856. var Models = _interopRequireWildcard(_ivprog_elements);
  15857. var _localizedStringsService = __webpack_require__(/*! ./../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  15858. var _globals = __webpack_require__(/*! ./globals */ "./js/visualUI/globals.js");
  15859. var GlobalsManagement = _interopRequireWildcard(_globals);
  15860. var _variables = __webpack_require__(/*! ./variables */ "./js/visualUI/variables.js");
  15861. var VariablesManagement = _interopRequireWildcard(_variables);
  15862. var _comment = __webpack_require__(/*! ./commands/comment */ "./js/visualUI/commands/comment.js");
  15863. var CommentsManagement = _interopRequireWildcard(_comment);
  15864. var _reader = __webpack_require__(/*! ./commands/reader */ "./js/visualUI/commands/reader.js");
  15865. var ReadersManagement = _interopRequireWildcard(_reader);
  15866. var _writer = __webpack_require__(/*! ./commands/writer */ "./js/visualUI/commands/writer.js");
  15867. var WritersManagement = _interopRequireWildcard(_writer);
  15868. var _attribution = __webpack_require__(/*! ./commands/attribution */ "./js/visualUI/commands/attribution.js");
  15869. var AttributionsManagement = _interopRequireWildcard(_attribution);
  15870. var _iftrue = __webpack_require__(/*! ./commands/iftrue */ "./js/visualUI/commands/iftrue.js");
  15871. var IftruesManagement = _interopRequireWildcard(_iftrue);
  15872. var _repeatNtimes = __webpack_require__(/*! ./commands/repeatNtimes */ "./js/visualUI/commands/repeatNtimes.js");
  15873. var RepeatNtimesManagement = _interopRequireWildcard(_repeatNtimes);
  15874. var _whiletrue = __webpack_require__(/*! ./commands/whiletrue */ "./js/visualUI/commands/whiletrue.js");
  15875. var WhiletruesManagement = _interopRequireWildcard(_whiletrue);
  15876. var _dowhiletrue = __webpack_require__(/*! ./commands/dowhiletrue */ "./js/visualUI/commands/dowhiletrue.js");
  15877. var DowhiletruesManagement = _interopRequireWildcard(_dowhiletrue);
  15878. var _switch = __webpack_require__(/*! ./commands/switch */ "./js/visualUI/commands/switch.js");
  15879. var SwitchesManagement = _interopRequireWildcard(_switch);
  15880. var _functioncall = __webpack_require__(/*! ./commands/functioncall */ "./js/visualUI/commands/functioncall.js");
  15881. var FunctioncallsManagement = _interopRequireWildcard(_functioncall);
  15882. var _variable_value_menu = __webpack_require__(/*! ./commands/variable_value_menu */ "./js/visualUI/commands/variable_value_menu.js");
  15883. var VariableValueMenuManagement = _interopRequireWildcard(_variable_value_menu);
  15884. var _break = __webpack_require__(/*! ./commands/break */ "./js/visualUI/commands/break.js");
  15885. var BreaksManagement = _interopRequireWildcard(_break);
  15886. var _return = __webpack_require__(/*! ./commands/return */ "./js/visualUI/commands/return.js");
  15887. var ReturnsManagement = _interopRequireWildcard(_return);
  15888. 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; } }
  15889. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  15890. var has_element_created_draged = false;
  15891. var which_element_is_draged = null;
  15892. function removeCommand(command, function_obj, dom_obj) {
  15893. if (function_obj.commands.indexOf(command) > -1) {
  15894. function_obj.commands.splice(function_obj.commands.indexOf(command), 1);
  15895. return true;
  15896. }
  15897. // Utilize dois parantNode, pois o primeiro é o div de comandos
  15898. try {
  15899. if (dom_obj.parent().parent().data('command').commands_block.indexOf(command) > -1) {
  15900. dom_obj.parent().parent().data('command').commands_block.splice(dom_obj.parent().parent().data('command').commands_block.indexOf(command), 1);
  15901. return true;
  15902. }
  15903. } catch (err) {}
  15904. try {
  15905. if (dom_obj.parent().parent().data('command').type == Models.COMMAND_TYPES.iftrue) {
  15906. if (dom_obj.parent().parent().data('command').commands_else.indexOf(command) > -1) {
  15907. dom_obj.parent().parent().data('command').commands_else.splice(dom_obj.parent().parent().data('command').commands_else.indexOf(command), 1);
  15908. return true;
  15909. }
  15910. }
  15911. } catch (err) {}
  15912. if (dom_obj.parent().data('switchcase')) {
  15913. console.log("o que encontrei: ");
  15914. console.log(dom_obj.parent().data('switchcase'));
  15915. dom_obj.parent().data('switchcase').commands_block.splice(dom_obj.parent().data('switchcase').commands_block.indexOf(command), 1);
  15916. return true;
  15917. }
  15918. return false;
  15919. }
  15920. function createFloatingCommand(function_obj, function_container, command_type, mouse_event) {
  15921. var floatingObject;
  15922. switch (command_type) {
  15923. case Models.COMMAND_TYPES.break:
  15924. floatingObject = BreaksManagement.createFloatingCommand();
  15925. break;
  15926. case Models.COMMAND_TYPES.comment:
  15927. floatingObject = CommentsManagement.createFloatingCommand();
  15928. break;
  15929. case Models.COMMAND_TYPES.reader:
  15930. floatingObject = ReadersManagement.createFloatingCommand();
  15931. break;
  15932. case Models.COMMAND_TYPES.writer:
  15933. floatingObject = WritersManagement.createFloatingCommand();
  15934. break;
  15935. case Models.COMMAND_TYPES.attribution:
  15936. floatingObject = AttributionsManagement.createFloatingCommand();
  15937. break;
  15938. case Models.COMMAND_TYPES.iftrue:
  15939. floatingObject = IftruesManagement.createFloatingCommand();
  15940. break;
  15941. case Models.COMMAND_TYPES.repeatNtimes:
  15942. floatingObject = RepeatNtimesManagement.createFloatingCommand();
  15943. break;
  15944. case Models.COMMAND_TYPES.whiletrue:
  15945. floatingObject = WhiletruesManagement.createFloatingCommand();
  15946. break;
  15947. case Models.COMMAND_TYPES.dowhiletrue:
  15948. floatingObject = DowhiletruesManagement.createFloatingCommand();
  15949. break;
  15950. case Models.COMMAND_TYPES.switch:
  15951. floatingObject = SwitchesManagement.createFloatingCommand();
  15952. break;
  15953. case Models.COMMAND_TYPES.functioncall:
  15954. floatingObject = FunctioncallsManagement.createFloatingCommand();
  15955. break;
  15956. case Models.COMMAND_TYPES.return:
  15957. floatingObject = ReturnsManagement.createFloatingCommand();
  15958. break;
  15959. }
  15960. floatingObject.draggable({
  15961. drag: function drag(evt) {
  15962. borderMouseDragCommand(function_obj, function_container, evt);
  15963. },
  15964. stop: function stop(evt) {
  15965. function_container.find('.over_command_drag').each(function (index) {
  15966. (0, _jquery2.default)(this).removeClass('over_command_drag');
  15967. });
  15968. }
  15969. }).appendTo("body");
  15970. floatingObject.mouseup(function (evt) {
  15971. manageCommand(function_obj, function_container, evt, command_type);
  15972. });
  15973. floatingObject.css("position", "absolute");
  15974. mouse_event.type = "mousedown.draggable";
  15975. mouse_event.target = floatingObject[0];
  15976. floatingObject.css("left", mouse_event.pageX - 15);
  15977. floatingObject.css("top", mouse_event.pageY - 15);
  15978. floatingObject.trigger(mouse_event);
  15979. }
  15980. function borderMouseDragCommand(function_obj, function_container, evt) {
  15981. function_container.find('.over_command_drag').each(function (index) {
  15982. (0, _jquery2.default)(this).removeClass('over_command_drag');
  15983. });
  15984. var prev = null;
  15985. function_container.find('.commands_list_div').each(function (index) {
  15986. prev = (0, _jquery2.default)(this);
  15987. if (prev) {
  15988. var objLeft = prev.offset().left;
  15989. var objTop = prev.offset().top;
  15990. var objRight = objLeft + prev.width();
  15991. var objBottom = objTop + prev.height();
  15992. if (evt.pageX > objLeft && evt.pageX < objRight && evt.pageY > objTop && evt.pageY < objBottom) {
  15993. prev.addClass("over_command_drag");
  15994. }
  15995. }
  15996. });
  15997. function_container.find('.command_container').each(function (index) {
  15998. var obj = (0, _jquery2.default)(this);
  15999. var objLeft = obj.offset().left;
  16000. var objTop = obj.offset().top;
  16001. var objRight = objLeft + obj.width();
  16002. var objBottom = objTop + obj.height();
  16003. if (evt.pageX > objLeft && evt.pageX < objRight && evt.pageY > objTop && evt.pageY < objBottom) {
  16004. if (prev) {
  16005. prev.removeClass('over_command_drag');
  16006. }
  16007. obj.addClass("over_command_drag");
  16008. return;
  16009. }
  16010. });
  16011. }
  16012. // before_after_inside: 1 -> before, 2 -> after, 3 -> inside
  16013. function renderCommand(command, element_reference, before_after_inside, function_obj) {
  16014. var createdElement;
  16015. switch (command.type) {
  16016. case Models.COMMAND_TYPES.comment:
  16017. createdElement = CommentsManagement.renderCommand(command, function_obj);
  16018. break;
  16019. case Models.COMMAND_TYPES.break:
  16020. createdElement = BreaksManagement.renderCommand(command, function_obj);
  16021. break;
  16022. case Models.COMMAND_TYPES.reader:
  16023. createdElement = ReadersManagement.renderCommand(command, function_obj);
  16024. break;
  16025. case Models.COMMAND_TYPES.writer:
  16026. createdElement = WritersManagement.renderCommand(command, function_obj);
  16027. break;
  16028. case Models.COMMAND_TYPES.attribution:
  16029. createdElement = AttributionsManagement.renderCommand(command, function_obj);
  16030. break;
  16031. case Models.COMMAND_TYPES.functioncall:
  16032. createdElement = FunctioncallsManagement.renderCommand(command, function_obj);
  16033. break;
  16034. case Models.COMMAND_TYPES.iftrue:
  16035. createdElement = IftruesManagement.renderCommand(command, function_obj);
  16036. break;
  16037. case Models.COMMAND_TYPES.repeatNtimes:
  16038. createdElement = RepeatNtimesManagement.renderCommand(command, function_obj);
  16039. break;
  16040. case Models.COMMAND_TYPES.whiletrue:
  16041. createdElement = WhiletruesManagement.renderCommand(command, function_obj);
  16042. break;
  16043. case Models.COMMAND_TYPES.dowhiletrue:
  16044. createdElement = DowhiletruesManagement.renderCommand(command, function_obj);
  16045. break;
  16046. case Models.COMMAND_TYPES.switch:
  16047. createdElement = SwitchesManagement.renderCommand(command, function_obj);
  16048. break;
  16049. case Models.COMMAND_TYPES.return:
  16050. createdElement = ReturnsManagement.renderCommand(command, function_obj);
  16051. break;
  16052. }
  16053. switch (before_after_inside) {
  16054. case 1:
  16055. createdElement.insertBefore(element_reference);
  16056. break;
  16057. case 2:
  16058. createdElement.insertAfter(element_reference);
  16059. break;
  16060. case 3:
  16061. element_reference.append(createdElement);
  16062. break;
  16063. }
  16064. }
  16065. function genericCreateCommand(command_type) {
  16066. switch (command_type) {
  16067. case Models.COMMAND_TYPES.break:
  16068. return new Models.Break();
  16069. case Models.COMMAND_TYPES.comment:
  16070. return new Models.Comment(new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.only_value, _localizedStringsService.LocalizedStrings.getUI('text_comment'), null, null, false));
  16071. case Models.COMMAND_TYPES.reader:
  16072. return new Models.Reader(new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.only_variable, null, null, null, false));
  16073. case Models.COMMAND_TYPES.writer:
  16074. return new Models.Writer([new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.all, null, null, null, true)]);
  16075. case Models.COMMAND_TYPES.attribution:
  16076. return new Models.Attribution(new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.only_variable, null, null, null, false), []);
  16077. case Models.COMMAND_TYPES.functioncall:
  16078. return new Models.FunctionCall(new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.only_function, null, null, null, false), null);
  16079. case Models.COMMAND_TYPES.iftrue:
  16080. return new Models.IfTrue(new Models.ConditionalExpression(null), null, null);
  16081. case Models.COMMAND_TYPES.repeatNtimes:
  16082. 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);
  16083. case Models.COMMAND_TYPES.whiletrue:
  16084. return new Models.WhileTrue(new Models.ConditionalExpression(null), null);
  16085. case Models.COMMAND_TYPES.dowhiletrue:
  16086. return new Models.DoWhileTrue(new Models.ConditionalExpression(null), null);
  16087. case Models.COMMAND_TYPES.switch:
  16088. var sc = [new Models.SwitchCase(new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.all, null, null, null, true))];
  16089. return new Models.Switch(new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.variable_and_function, null, null, null, true), sc);
  16090. case Models.COMMAND_TYPES.return:
  16091. return new Models.Return(new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.all, null, null, null, true));
  16092. }
  16093. }
  16094. function dragTrash(event) {
  16095. var trash = (0, _jquery2.default)('<i class="ui icon trash alternate outline"></i>');
  16096. (0, _jquery2.default)('body').append(trash);
  16097. trash.css('position', 'absolute');
  16098. trash.css('top', event.clientY);
  16099. trash.css('left', event.clientX - 20);
  16100. trash.css('font-size', '3em');
  16101. trash.css('display', 'none');
  16102. trash.fadeIn(200, function () {
  16103. trash.fadeOut(200, function () {
  16104. trash.remove();
  16105. });
  16106. });
  16107. }
  16108. function manageCommand(function_obj, function_container, event, command_type) {
  16109. (0, _jquery2.default)(".created_element").each(function (index) {
  16110. (0, _jquery2.default)(this).remove();
  16111. });
  16112. var el = (0, _jquery2.default)(document.elementFromPoint(event.clientX, event.clientY));
  16113. console.log('soltou no: ');
  16114. console.log(el);
  16115. console.log(el.data('fun'));
  16116. // Primeiro verificar se ele soltou no espaço da função correta:
  16117. var hier = el.parentsUntil(".all_functions");
  16118. var esta_correto = false;
  16119. var esta_na_div_correta = false;
  16120. if (el.hasClass("commands_list_div")) {
  16121. esta_na_div_correta = true;
  16122. }
  16123. for (var i = 0; i < hier.length; i++) {
  16124. var temp = (0, _jquery2.default)(hier[i]);
  16125. if (temp.hasClass("commands_list_div")) {
  16126. esta_na_div_correta = true;
  16127. }
  16128. if (temp.data('fun') == function_obj) {
  16129. esta_correto = true;
  16130. break;
  16131. }
  16132. }
  16133. if (!esta_correto) {
  16134. has_element_created_draged = false;
  16135. which_element_is_draged = null;
  16136. dragTrash(event);
  16137. return;
  16138. } else {
  16139. if (!esta_na_div_correta) {
  16140. has_element_created_draged = false;
  16141. which_element_is_draged = null;
  16142. dragTrash(event);
  16143. return;
  16144. }
  16145. }
  16146. // Agora é descobrir qual o escopo para adicionar o comando:
  16147. // Se o elemento clicado possuir o atributo "fun", então, é direto na div dos comandos:
  16148. if (typeof el.data('fun') !== 'undefined') {
  16149. // Se a lista de comandos estiver vazia, então é o primeiro.
  16150. // Portanto, ele deve soltar o elemento obrigatoriamente no objeto vazio
  16151. if (el.data('fun').commands == null || el.data('fun').commands.length == 0) {
  16152. // pode adicionar
  16153. el.data('fun').commands = [];
  16154. var new_cmd = genericCreateCommand(command_type);
  16155. el.data('fun').commands.push(new_cmd);
  16156. renderCommand(new_cmd, (0, _jquery2.default)(function_container).find('.commands_list_div'), 3, function_obj);
  16157. } else {
  16158. // Entra nesse else, caso já existam outros comandos no bloco:
  16159. findNearbyCommandToAddInFunctionScope(el, event, (0, _jquery2.default)(function_container).find('.commands_list_div'), function_obj, command_type);
  16160. }
  16161. } else {
  16162. console.log("soltou em um comando");
  16163. // descobrir em qual comando ele soltou:
  16164. var hier_find = el.parentsUntil(".commands_list_div");
  16165. var hierarquia_bottom_up = [];
  16166. if (typeof el.data('command') !== 'undefined') {
  16167. hierarquia_bottom_up.push(el.data('command'));
  16168. }
  16169. for (var i = 0; i < hier_find.length; i++) {
  16170. if (typeof (0, _jquery2.default)(hier_find[i]).data('command') !== 'undefined') {
  16171. hierarquia_bottom_up.push((0, _jquery2.default)(hier_find[i]).data('command'));
  16172. }
  16173. }
  16174. console.log("comando em que soltou: ");
  16175. console.log(hierarquia_bottom_up[0]);
  16176. console.log("hierarquia de baixo para cima na árvore, de onde ele soltou: ");
  16177. for (var i = 0; i < hierarquia_bottom_up.length; i++) {
  16178. console.log(hierarquia_bottom_up[i]);
  16179. }
  16180. // Se for do tipo break, verificar se está no contexto correto:
  16181. // Caso não esteja no contexto, apenas retorna sem dar continuidade:
  16182. var is_correct_context = false;
  16183. if (command_type == Models.COMMAND_TYPES.break) {
  16184. for (var i = 0; i < hierarquia_bottom_up.length; i++) {
  16185. 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) {
  16186. is_correct_context = true;
  16187. break;
  16188. }
  16189. }
  16190. if (!is_correct_context) {
  16191. console.error("Context not allowed to insert BREAK COMMAND!");
  16192. return;
  16193. }
  16194. }
  16195. // se a hierarquia possuir apenas um elemento, então está na raiz dos comandos:
  16196. if (hierarquia_bottom_up.length == 1) {
  16197. console.log('QQ1');
  16198. var sub_elemento = false;
  16199. for (var i = 0; i < hier_find.length; i++) {
  16200. if (typeof (0, _jquery2.default)(hier_find[i]).data('command') !== 'undefined') {
  16201. console.log('QQ2');
  16202. findBeforeOrAfterCommandToAdd(hier_find[i], event, function_obj, command_type);
  16203. sub_elemento = true;
  16204. break;
  16205. }
  16206. }
  16207. if (!sub_elemento) {
  16208. console.log('QQ3');
  16209. findBeforeOrAfterCommandToAdd(el[0], event, function_obj, command_type);
  16210. }
  16211. } else {
  16212. console.log('QQ4');
  16213. // caso exista mais de um elemento na hierarquia:
  16214. if (typeof (0, _jquery2.default)(el).data('command') !== 'undefined') {
  16215. console.log('QQ5');
  16216. console.log("PPP1");
  16217. insertCommandInBlockHierar(el[0], event, function_obj, command_type, hier_find, hierarquia_bottom_up);
  16218. } else {
  16219. console.log('QQ6');
  16220. var sub_elemento = false;
  16221. for (var i = 0; i < hier_find.length; i++) {
  16222. if (typeof (0, _jquery2.default)(hier_find[i]).data('command') !== 'undefined') {
  16223. console.log('QQ7');
  16224. insertCommandInBlockHierar(hier_find[i], event, function_obj, command_type, hier_find, hierarquia_bottom_up);
  16225. sub_elemento = true;
  16226. break;
  16227. }
  16228. }
  16229. }
  16230. }
  16231. }
  16232. has_element_created_draged = false;
  16233. which_element_is_draged = null;
  16234. renderAlgorithm();
  16235. }
  16236. function insertCommandInBlockHierar(el, event, function_obj, command_type, hier_dom, hier_obj) {
  16237. var el_jq = (0, _jquery2.default)(el);
  16238. var command_parent = el_jq.data('command');
  16239. 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) {
  16240. console.log('QQ17');
  16241. 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) {
  16242. console.log('QQ18');
  16243. // Se não tiver outro comando ainda no bloco, só adiciona:
  16244. if (command_parent.commands_block == null || command_parent.commands_block.length == 0) {
  16245. command_parent.commands_block = [];
  16246. var recentComand = genericCreateCommand(command_type);
  16247. command_parent.commands_block.push(recentComand);
  16248. renderCommand(recentComand, el_jq.find('.block_commands'), 3, function_obj);
  16249. } else {
  16250. // Se já tem algum comando no bloco:
  16251. findNearbyCommandToAddInBlockScope(el, event, el, function_obj, command_type, command_parent);
  16252. }
  16253. } else {
  16254. // QUANDO FOR BLOCO DO TIPO IF OU SWITCH/CASE:
  16255. addCommandToSwitchCase(event, function_obj, command_type);
  16256. }
  16257. } else {
  16258. console.log('QQ19');
  16259. // entra neste bloco, se soltou o comando sobre outro comando dentro de um subbloco:
  16260. findBeforeOrAfterCommandToAddInsertBlock(el, event, function_obj, command_type);
  16261. }
  16262. }
  16263. function findNearbyCommandToAddInBlockScope(el, event, node_list_commands, function_obj, command_type, command_parent) {
  16264. var all_sub = (0, _jquery2.default)(node_list_commands).find('div.command_container');
  16265. var menor_distancia = 999999999;
  16266. var elemento_menor_distancia = null;
  16267. var antes = true;
  16268. var t_bot;
  16269. var t_top;
  16270. // Descobrindo o elemento mais próximo:
  16271. for (var i = 0; i < all_sub.length; i++) {
  16272. t_top = all_sub[i].getBoundingClientRect().top;
  16273. t_bot = all_sub[i].getBoundingClientRect().top + all_sub[i].getBoundingClientRect().height;
  16274. if (t_top - event.clientY < menor_distancia) {
  16275. menor_distancia = event.clientY - t_top;
  16276. elemento_menor_distancia = all_sub[i];
  16277. }
  16278. }
  16279. var borda_inferior = elemento_menor_distancia.parentNode.getBoundingClientRect().top + elemento_menor_distancia.parentNode.getBoundingClientRect().height;
  16280. // Está mais próximo da borda de baixo, ou seja.. inserir por último:
  16281. if (borda_inferior - event.clientY < menor_distancia) {
  16282. var recentComand = genericCreateCommand(command_type);
  16283. command_parent.commands_block.push(recentComand);
  16284. //
  16285. renderCommand(recentComand, node_list_commands, 3, function_obj);
  16286. } else {
  16287. var recentComand = genericCreateCommand(command_type);
  16288. var index = command_parent.commands_block.indexOf((0, _jquery2.default)(elemento_menor_distancia).data('command'));
  16289. if (index > -1) {
  16290. command_parent.commands_block.splice(index, 0, recentComand);
  16291. }
  16292. renderCommand(recentComand, elemento_menor_distancia, 1, function_obj);
  16293. }
  16294. }
  16295. function findBeforeOrAfterCommandToAddInsertBlock(el, event, function_obj, command_type) {
  16296. var el_jq = (0, _jquery2.default)(el);
  16297. var command_parent = (0, _jquery2.default)(el.parentNode.parentNode).data('command');
  16298. var command_target = el_jq.data('command');
  16299. var temp_parent = (0, _jquery2.default)(el.parentNode.parentNode);
  16300. var is_in_else = false;
  16301. if (!command_parent) {
  16302. command_parent = el_jq.data('command');
  16303. temp_parent = el_jq;
  16304. var hier = el_jq.parentsUntil(".command_container");
  16305. for (var i = 0; i < hier.length; i++) {
  16306. var temp = (0, _jquery2.default)(hier[i]);
  16307. if (typeof temp.data('else') != 'undefined') {
  16308. is_in_else = true;
  16309. }
  16310. if (typeof temp.data('command') != 'undefined') {
  16311. command_parent = temp.data('command');
  16312. temp_parent = temp;
  16313. }
  16314. }
  16315. }
  16316. var hier = el_jq.parentsUntil(".command_container");
  16317. for (var i = 0; i < hier.length; i++) {
  16318. var temp = (0, _jquery2.default)(hier[i]);
  16319. if (typeof temp.data('else') != 'undefined') {
  16320. is_in_else = true;
  16321. }
  16322. }
  16323. if (command_parent == command_target) {
  16324. var hier = el_jq.parentsUntil(".command_container");
  16325. for (var i = 0; i < hier.length; i++) {
  16326. var temp = (0, _jquery2.default)(hier[i]);
  16327. if (typeof temp.data('else') !== 'undefined') {
  16328. is_in_else = true;
  16329. break;
  16330. }
  16331. }
  16332. }
  16333. if (command_parent.type != Models.COMMAND_TYPES.iftrue && command_parent.type != Models.COMMAND_TYPES.switch) {
  16334. var hier = temp_parent.parentsUntil(".all_cases_div");
  16335. console.log("vou procurar!!");
  16336. for (var i = 0; i < hier.length; i++) {
  16337. console.log("estou vasculhando...");
  16338. var temp = (0, _jquery2.default)(hier[i]);
  16339. if (typeof temp.data('switchcase') !== 'undefined') {
  16340. console.log("encontrei");
  16341. command_parent = temp.data('switchcase');
  16342. is_in_else = false;
  16343. break;
  16344. }
  16345. }
  16346. }
  16347. console.log('debugging:');
  16348. console.log('el_jq');
  16349. console.log(el_jq);
  16350. console.log('command_parent');
  16351. console.log(command_parent);
  16352. console.log('command_target');
  16353. console.log(command_target);
  16354. var menor_distancia = 999999999;
  16355. var antes = true;
  16356. var t_bot;
  16357. var t_top;
  16358. t_top = el.getBoundingClientRect().top;
  16359. t_bot = el.getBoundingClientRect().top + el.getBoundingClientRect().height;
  16360. var d_top = event.clientY - t_top; // distancia topo
  16361. var d_bot = t_bot - event.clientY; // distancia baixo
  16362. // Está mais próximo da borda de baixo, ou seja.. inserir por último:
  16363. if (d_top < d_bot) {
  16364. var recentComand = genericCreateCommand(command_type);
  16365. console.log('MMM1');
  16366. if (is_in_else) {
  16367. console.log('MMM2');
  16368. if (command_parent == command_target) {
  16369. console.log('MMM3');
  16370. if (command_parent.commands_else == null || command_parent.commands_else.length == 0) {
  16371. command_parent.commands_else = [];
  16372. var recentComand = genericCreateCommand(command_type);
  16373. command_parent.commands_else.push(recentComand);
  16374. renderCommand(recentComand, el_jq, 3, function_obj);
  16375. } else {
  16376. // Se já tem algum comando no bloco:
  16377. findInBlockCorrectPlace(el_jq, event, function_obj, command_type, true);
  16378. }
  16379. return;
  16380. }
  16381. console.log('MMM7');
  16382. var index = command_parent.commands_else.indexOf(command_target);
  16383. if (index > -1) {
  16384. command_parent.commands_else.splice(index, 0, recentComand);
  16385. }
  16386. renderCommand(recentComand, el, 1, function_obj);
  16387. } else {
  16388. console.log('MMM4');
  16389. if (command_parent == command_target) {
  16390. console.log('Nxxxx5');
  16391. if (command_parent.commands_block == null || command_parent.commands_block.length == 0) {
  16392. command_parent.commands_block = [];
  16393. console.log('SSS4');
  16394. var recentComand = genericCreateCommand(command_type);
  16395. command_parent.commands_block.push(recentComand);
  16396. renderCommand(recentComand, el_jq, 3, function_obj);
  16397. } else {
  16398. console.log('SSS5');
  16399. findInBlockCorrectPlace(el_jq, event, function_obj, command_type);
  16400. }
  16401. return;
  16402. }
  16403. console.log('MMM6');
  16404. var index = command_parent.commands_block.indexOf(command_target);
  16405. if (index > -1) {
  16406. command_parent.commands_block.splice(index, 0, recentComand);
  16407. }
  16408. renderCommand(recentComand, el, 1, function_obj);
  16409. }
  16410. } else {
  16411. console.log('XXX1');
  16412. var recentComand = genericCreateCommand(command_type);
  16413. if (is_in_else) {
  16414. if (command_parent == command_target) {
  16415. console.log('MMM3');
  16416. if (command_parent.commands_else == null || command_parent.commands_else.length == 0) {
  16417. command_parent.commands_else = [];
  16418. console.log('SSS1');
  16419. var recentComand = genericCreateCommand(command_type);
  16420. command_parent.commands_else.push(recentComand);
  16421. renderCommand(recentComand, el_jq, 3, function_obj);
  16422. } else {
  16423. // Se já tem algum comando no bloco:
  16424. console.log('SSS2');
  16425. findInBlockCorrectPlace(el_jq, event, function_obj, command_type, true);
  16426. }
  16427. return;
  16428. }
  16429. console.log('XXX2');
  16430. var index = command_parent.commands_else.indexOf(command_target);
  16431. if (index > -1) {
  16432. command_parent.commands_else.splice(index + 1, 0, recentComand);
  16433. }
  16434. renderCommand(recentComand, el, 2, function_obj);
  16435. } else {
  16436. if (command_parent == command_target) {
  16437. console.log('Nxxxx78');
  16438. if (command_parent.commands_block == null || command_parent.commands_block.length == 0) {
  16439. command_parent.commands_block = [];
  16440. var recentComand = genericCreateCommand(command_type);
  16441. command_parent.commands_block.push(recentComand);
  16442. console.log('SSS6');
  16443. renderCommand(recentComand, el_jq, 3, function_obj);
  16444. } else {
  16445. console.log('SSS7');
  16446. findInBlockCorrectPlace(el_jq, event, function_obj, command_type);
  16447. }
  16448. return;
  16449. }
  16450. console.log('XXX3');
  16451. var index = command_parent.commands_block.indexOf(command_target);
  16452. if (index > -1) {
  16453. command_parent.commands_block.splice(index + 1, 0, recentComand);
  16454. }
  16455. renderCommand(recentComand, el, 2, function_obj);
  16456. }
  16457. }
  16458. }
  16459. function insertCommandInBlock(el, event, function_obj, command_type) {
  16460. var el_jq = (0, _jquery2.default)(el);
  16461. var command_parent = el_jq.data('command');
  16462. 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) {
  16463. // Se não tiver outro comando ainda no bloco, só adiciona:
  16464. if (command_parent.commands_block == null || command_parent.commands_block.length == 0) {
  16465. command_parent.commands_block = [];
  16466. var recentComand = genericCreateCommand(command_type);
  16467. command_parent.commands_block.push(recentComand);
  16468. renderCommand(recentComand, el_jq.find('.block_commands'), 3, function_obj);
  16469. } else {
  16470. // Se já tem algum comando no bloco:
  16471. findInBlockCorrectPlace(el, event, function_obj, command_type);
  16472. }
  16473. } else if (el_jq.data('command').type == Models.COMMAND_TYPES.iftrue) {
  16474. console.log('QQ9');
  16475. // no if ou no else?
  16476. var correct_div = (0, _jquery2.default)(document.elementFromPoint(event.pageX, event.pageY));
  16477. var is_in_if = true;
  16478. if (correct_div.data('if')) {
  16479. is_in_if = true;
  16480. } else if (correct_div.data('else')) {
  16481. is_in_if = false;
  16482. } else {
  16483. var hier = correct_div.parentsUntil(".command_container");
  16484. for (var i = 0; i < hier.length; i++) {
  16485. var temp = (0, _jquery2.default)(hier[i]);
  16486. if (typeof temp.data('if') !== 'undefined') {
  16487. is_in_if = true;
  16488. break;
  16489. }
  16490. if (typeof temp.data('else') !== 'undefined') {
  16491. is_in_if = false;
  16492. break;
  16493. }
  16494. }
  16495. }
  16496. if (is_in_if) {
  16497. if (command_parent.commands_block == null || command_parent.commands_block.length == 0) {
  16498. command_parent.commands_block = [];
  16499. var recentComand = genericCreateCommand(command_type);
  16500. command_parent.commands_block.push(recentComand);
  16501. renderCommand(recentComand, el_jq.find('.commands_if'), 3, function_obj);
  16502. } else {
  16503. // Se já tem algum comando no bloco:
  16504. findInBlockCorrectPlace(el_jq.find('.commands_if'), event, function_obj, command_type);
  16505. }
  16506. } else {
  16507. if (command_parent.commands_else == null || command_parent.commands_else.length == 0) {
  16508. command_parent.commands_else = [];
  16509. var recentComand = genericCreateCommand(command_type);
  16510. command_parent.commands_else.push(recentComand);
  16511. renderCommand(recentComand, el_jq.find('.commands_else'), 3, function_obj);
  16512. } else {
  16513. // Se já tem algum comando no bloco:
  16514. findInBlockCorrectPlace(el_jq.find('.commands_else'), event, function_obj, command_type, true);
  16515. }
  16516. }
  16517. } else {
  16518. // é do tipo switch
  16519. console.log("está tentando inserir em um switch que está na raiz!");
  16520. addCommandToSwitchCase(event, function_obj, command_type);
  16521. }
  16522. }
  16523. function addCommandToSwitchCase(event, function_obj, command_type) {
  16524. var el = (0, _jquery2.default)(document.elementFromPoint(event.clientX, event.clientY));
  16525. var which_case = el.data('switchcase');
  16526. var case_div = el;
  16527. if (!which_case) {
  16528. var hier_find = el.parentsUntil(".all_cases_div");
  16529. for (var i = 0; i < hier_find.length; i++) {
  16530. if (typeof (0, _jquery2.default)(hier_find[i]).data('switchcase') !== 'undefined') {
  16531. which_case = (0, _jquery2.default)(hier_find[i]).data('switchcase');
  16532. case_div = (0, _jquery2.default)(hier_find[i]);
  16533. break;
  16534. }
  16535. }
  16536. }
  16537. if (which_case.commands_block == null || which_case.commands_block.length < 1) {
  16538. which_case.commands_block = [];
  16539. var recentComand = genericCreateCommand(command_type);
  16540. which_case.commands_block.push(recentComand);
  16541. renderCommand(recentComand, case_div.find('.case_commands_block'), 3, function_obj);
  16542. } else {
  16543. findInBlockCorrectPlaceInSwitchCase(which_case, case_div, event, function_obj, command_type);
  16544. }
  16545. }
  16546. function findInBlockCorrectPlaceInSwitchCase(which_case, case_div, event, function_obj, command_type) {
  16547. var all_sub = case_div.find('div.command_container');
  16548. var menor_distancia = 999999999;
  16549. var elemento_menor_distancia = null;
  16550. var antes = true;
  16551. var t_bot;
  16552. var t_top;
  16553. // Descobrindo o elemento mais próximo:
  16554. for (var i = 0; i < all_sub.length; i++) {
  16555. t_top = all_sub[i].getBoundingClientRect().top;
  16556. t_bot = all_sub[i].getBoundingClientRect().top + all_sub[i].getBoundingClientRect().height;
  16557. if (t_top - event.clientY < menor_distancia) {
  16558. menor_distancia = event.clientY - t_top;
  16559. elemento_menor_distancia = all_sub[i];
  16560. }
  16561. }
  16562. var borda_inferior = elemento_menor_distancia.parentNode.getBoundingClientRect().top + elemento_menor_distancia.parentNode.getBoundingClientRect().height;
  16563. // Está mais próximo da borda de baixo, ou seja.. inserir por último:
  16564. if (borda_inferior - event.clientY < menor_distancia) {
  16565. var recentComand = genericCreateCommand(command_type);
  16566. which_case.commands_block.push(recentComand);
  16567. renderCommand(recentComand, (0, _jquery2.default)(case_div.find('.case_commands_block')[0]), 3, function_obj);
  16568. } else {
  16569. var recentComand = genericCreateCommand(command_type);
  16570. var index = which_case.commands_block.indexOf((0, _jquery2.default)(elemento_menor_distancia).data('command'));
  16571. if (index > -1) {
  16572. which_case.commands_block.splice(index, 0, recentComand);
  16573. renderCommand(recentComand, elemento_menor_distancia, 1, function_obj);
  16574. }
  16575. }
  16576. }
  16577. function findInBlockCorrectPlace(el, event, function_obj, command_type) {
  16578. var is_in_else = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
  16579. var el_jq = (0, _jquery2.default)(el);
  16580. var all_sub = el_jq.find('div.command_container');
  16581. var menor_distancia = 999999999;
  16582. var elemento_menor_distancia = null;
  16583. var antes = true;
  16584. var t_bot;
  16585. var t_top;
  16586. // Descobrindo o elemento mais próximo:
  16587. for (var i = 0; i < all_sub.length; i++) {
  16588. t_top = all_sub[i].getBoundingClientRect().top;
  16589. t_bot = all_sub[i].getBoundingClientRect().top + all_sub[i].getBoundingClientRect().height;
  16590. if (t_top - event.clientY < menor_distancia) {
  16591. menor_distancia = event.clientY - t_top;
  16592. elemento_menor_distancia = all_sub[i];
  16593. }
  16594. }
  16595. var borda_inferior = elemento_menor_distancia.parentNode.getBoundingClientRect().top + elemento_menor_distancia.parentNode.getBoundingClientRect().height;
  16596. console.log("menor_distancia: ");
  16597. console.log(elemento_menor_distancia);
  16598. // Está mais próximo da borda de baixo, ou seja.. inserir por último:
  16599. if (borda_inferior - event.clientY < menor_distancia) {
  16600. console.log('QQ11');
  16601. var recentComand = genericCreateCommand(command_type);
  16602. var command_parent = el_jq.data('command');
  16603. if (is_in_else) {
  16604. console.log('QQ15');
  16605. command_parent.commands_else.push(recentComand);
  16606. console.log('el_jq');
  16607. console.log(el_jq);
  16608. console.log("$(el_jq.find('.commands_else')[0]):: ");
  16609. console.log((0, _jquery2.default)(el_jq.find('.commands_else')[0]));
  16610. renderCommand(recentComand, el_jq, 3, function_obj);
  16611. } else {
  16612. console.log('QQ16');
  16613. command_parent.commands_block.push(recentComand);
  16614. renderCommand(recentComand, (0, _jquery2.default)(el_jq.find('.block_commands')[0]), 3, function_obj);
  16615. }
  16616. } else {
  16617. console.log('QQ12');
  16618. var recentComand = genericCreateCommand(command_type);
  16619. var command_parent = el_jq.data('command');
  16620. if (is_in_else) {
  16621. var index = command_parent.commands_else.indexOf((0, _jquery2.default)(elemento_menor_distancia).data('command'));
  16622. if (index > -1) {
  16623. command_parent.commands_else.splice(index, 0, recentComand);
  16624. renderCommand(recentComand, elemento_menor_distancia, 1, function_obj);
  16625. }
  16626. } else {
  16627. var index = command_parent.commands_block.indexOf((0, _jquery2.default)(elemento_menor_distancia).data('command'));
  16628. if (index > -1) {
  16629. command_parent.commands_block.splice(index, 0, recentComand);
  16630. renderCommand(recentComand, elemento_menor_distancia, 1, function_obj);
  16631. }
  16632. }
  16633. }
  16634. }
  16635. function findBeforeOrAfterCommandToAdd(el, event, function_obj, command_type) {
  16636. switch ((0, _jquery2.default)(el).data('command').type) {
  16637. case Models.COMMAND_TYPES.iftrue:
  16638. case Models.COMMAND_TYPES.switch:
  16639. case Models.COMMAND_TYPES.repeatNtimes:
  16640. case Models.COMMAND_TYPES.whiletrue:
  16641. case Models.COMMAND_TYPES.dowhiletrue:
  16642. insertCommandInBlock(el, event, function_obj, command_type);
  16643. return;
  16644. }
  16645. var menor_distancia = 999999999;
  16646. var antes = true;
  16647. var t_bot;
  16648. var t_top;
  16649. t_top = el.getBoundingClientRect().top;
  16650. t_bot = el.getBoundingClientRect().top + el.getBoundingClientRect().height;
  16651. var d_top = event.clientY - t_top; // distancia topo
  16652. var d_bot = t_bot - event.clientY; // distancia baixo
  16653. // Está mais próximo da borda de baixo, ou seja.. inserir por último:
  16654. if (d_top < d_bot) {
  16655. var recentComand = genericCreateCommand(command_type);
  16656. var index = function_obj.commands.indexOf((0, _jquery2.default)(el).data('command'));
  16657. if (index > -1) {
  16658. function_obj.commands.splice(index, 0, recentComand);
  16659. }
  16660. renderCommand(recentComand, el, 1, function_obj);
  16661. } else {
  16662. var recentComand = genericCreateCommand(command_type);
  16663. var index = function_obj.commands.indexOf((0, _jquery2.default)(el).data('command'));
  16664. if (index > -1) {
  16665. function_obj.commands.splice(index + 1, 0, recentComand);
  16666. }
  16667. renderCommand(recentComand, el, 2, function_obj);
  16668. }
  16669. }
  16670. function findNearbyCommandToAddInFunctionScope(el, event, node_list_commands, function_obj, command_type) {
  16671. var all_sub = (0, _jquery2.default)(node_list_commands).find('div.command_container');
  16672. var menor_distancia = 999999999;
  16673. var elemento_menor_distancia = null;
  16674. var antes = true;
  16675. var t_bot;
  16676. var t_top;
  16677. // Descobrindo o elemento mais próximo:
  16678. for (var i = 0; i < all_sub.length; i++) {
  16679. t_top = all_sub[i].getBoundingClientRect().top;
  16680. t_bot = all_sub[i].getBoundingClientRect().top + all_sub[i].getBoundingClientRect().height;
  16681. if (t_top - event.clientY < menor_distancia) {
  16682. menor_distancia = event.clientY - t_top;
  16683. elemento_menor_distancia = all_sub[i];
  16684. }
  16685. }
  16686. var borda_inferior = elemento_menor_distancia.parentNode.getBoundingClientRect().top + elemento_menor_distancia.parentNode.getBoundingClientRect().height;
  16687. // Está mais próximo da borda de baixo, ou seja.. inserir por último:
  16688. if (borda_inferior - event.clientY < menor_distancia) {
  16689. var recentComand = genericCreateCommand(command_type);
  16690. function_obj.commands.push(recentComand);
  16691. //
  16692. renderCommand(recentComand, node_list_commands, 3, function_obj);
  16693. } else {
  16694. var recentComand = genericCreateCommand(command_type);
  16695. var index = function_obj.commands.indexOf((0, _jquery2.default)(elemento_menor_distancia).data('command'));
  16696. if (index > -1) {
  16697. function_obj.commands.splice(index, 0, recentComand);
  16698. }
  16699. renderCommand(recentComand, elemento_menor_distancia, 1, function_obj);
  16700. }
  16701. }
  16702. /***/ }),
  16703. /***/ "./js/visualUI/commands/attribution.js":
  16704. /*!*********************************************!*\
  16705. !*** ./js/visualUI/commands/attribution.js ***!
  16706. \*********************************************/
  16707. /*! no static exports found */
  16708. /***/ (function(module, exports, __webpack_require__) {
  16709. "use strict";
  16710. Object.defineProperty(exports, "__esModule", {
  16711. value: true
  16712. });
  16713. exports.createFloatingCommand = createFloatingCommand;
  16714. exports.renderCommand = renderCommand;
  16715. exports.manageExpressionElements = manageExpressionElements;
  16716. exports.renderMenuOperations = renderMenuOperations;
  16717. var _jquery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  16718. var _jquery2 = _interopRequireDefault(_jquery);
  16719. var _types = __webpack_require__(/*! ../types */ "./js/visualUI/types.js");
  16720. var _ivprog_elements = __webpack_require__(/*! ../ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  16721. var Models = _interopRequireWildcard(_ivprog_elements);
  16722. var _localizedStringsService = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  16723. var _globals = __webpack_require__(/*! ../globals */ "./js/visualUI/globals.js");
  16724. var GlobalsManagement = _interopRequireWildcard(_globals);
  16725. var _variables = __webpack_require__(/*! ../variables */ "./js/visualUI/variables.js");
  16726. var VariablesManagement = _interopRequireWildcard(_variables);
  16727. var _variable_value_menu = __webpack_require__(/*! ./variable_value_menu */ "./js/visualUI/commands/variable_value_menu.js");
  16728. var VariableValueMenu = _interopRequireWildcard(_variable_value_menu);
  16729. var VariableValueMenuManagement = _interopRequireWildcard(_variable_value_menu);
  16730. var _commands = __webpack_require__(/*! ../commands */ "./js/visualUI/commands.js");
  16731. var CommandsManagement = _interopRequireWildcard(_commands);
  16732. 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; } }
  16733. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  16734. function createFloatingCommand() {
  16735. return (0, _jquery2.default)('<div class="ui attribution created_element"> <i class="ui icon small arrow left"></i> <span> x = 1 + 1 </span></div>');
  16736. }
  16737. function renderCommand(command, function_obj) {
  16738. 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>');
  16739. el.data('command', command);
  16740. VariableValueMenu.renderMenu(command, command.variable, el.find('.var_attributed'), function_obj);
  16741. if (!command.expression || command.expression.length < 1) {
  16742. 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)]);
  16743. command.expression.push(exp);
  16744. }
  16745. addHandlers(command, function_obj, el);
  16746. renderExpressionElements(command, function_obj, el);
  16747. return el;
  16748. }
  16749. function manageExpressionElements(command, ref_object, dom_object, menu_var_or_value, function_obj, selectedItem, expression_element) {
  16750. var index_to_move = expression_element.itens.indexOf(ref_object);
  16751. switch (selectedItem.data('exp')) {
  16752. case Models.EXPRESSION_ELEMENTS.exp_op_exp:
  16753. 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)]);
  16754. expression_element.itens[index_to_move] = exp;
  16755. break;
  16756. case Models.EXPRESSION_ELEMENTS.op_exp:
  16757. var exp = new Models.ExpressionElement(Models.EXPRESSION_ELEMENTS.op_exp, [Models.ARITHMETIC_TYPES.plus, expression_element.itens[index_to_move]]);
  16758. expression_element.itens[index_to_move] = exp;
  16759. break;
  16760. case Models.EXPRESSION_ELEMENTS.par_exp_par:
  16761. var exp = new Models.ExpressionElement(Models.EXPRESSION_ELEMENTS.par_exp_par, [expression_element.itens[index_to_move]]);
  16762. expression_element.itens[index_to_move] = exp;
  16763. break;
  16764. }
  16765. renderExpressionElements(command, function_obj, dom_object);
  16766. }
  16767. function renderExpressionElements(command, function_obj, el) {
  16768. var expression_div = el.find('.expression_elements');
  16769. var command_container;
  16770. if (el.hasClass("command_container") == false) {
  16771. var hier = el.parentsUntil(".command_container");
  16772. for (var i = 0; i < hier.length; i++) {
  16773. if ((0, _jquery2.default)(hier[i]).hasClass("command_container")) {
  16774. command_container = (0, _jquery2.default)(hier[i]);
  16775. break;
  16776. }
  16777. if ((0, _jquery2.default)(hier[i]).hasClass("expression_elements")) {
  16778. expression_div = (0, _jquery2.default)(hier[i]);
  16779. break;
  16780. }
  16781. }
  16782. }
  16783. if (command_container) {
  16784. expression_div = command_container.find('.expression_elements');
  16785. }
  16786. expression_div.text('');
  16787. for (var i = 0; i < command.expression.length; i++) {
  16788. var temp = (0, _jquery2.default)('<div class="expression_element"></div>');
  16789. temp.data('ref_element', command.expression[i]);
  16790. temp.data('ref_index', i);
  16791. expression_div.append(temp);
  16792. renderElement(command, function_obj, temp, command.expression[i]);
  16793. }
  16794. }
  16795. function renderOperator(command, function_obj, temp_op, expression_element, index_op) {
  16796. var context_menu = '<div class="ui dropdown"><div class="text">';
  16797. switch (expression_element.itens[index_op]) {
  16798. case Models.ARITHMETIC_TYPES.plus:
  16799. context_menu += '+';
  16800. break;
  16801. case Models.ARITHMETIC_TYPES.minus:
  16802. context_menu += '-';
  16803. break;
  16804. case Models.ARITHMETIC_TYPES.multiplication:
  16805. context_menu += '*';
  16806. break;
  16807. case Models.ARITHMETIC_TYPES.division:
  16808. context_menu += '/';
  16809. break;
  16810. case Models.ARITHMETIC_TYPES.module:
  16811. context_menu += '%';
  16812. break;
  16813. case Models.ARITHMETIC_TYPES.none:
  16814. context_menu += '...';
  16815. break;
  16816. }
  16817. context_menu += '</div><div class="menu">';
  16818. context_menu += '<div class="item" data-value="' + Models.ARITHMETIC_TYPES.plus + '">+</div>';
  16819. context_menu += '<div class="item" data-value="' + Models.ARITHMETIC_TYPES.minus + '">-</div>';
  16820. context_menu += '<div class="item" data-value="' + Models.ARITHMETIC_TYPES.multiplication + '">*</div>';
  16821. context_menu += '<div class="item" data-value="' + Models.ARITHMETIC_TYPES.division + '">/</div>';
  16822. context_menu += '<div class="item" data-value="' + Models.ARITHMETIC_TYPES.module + '">%</div>';
  16823. context_menu += '<div class="item" data-value="' + Models.ARITHMETIC_TYPES.none + '" data-text="...">Nenhum</div>';
  16824. context_menu += '</div></div>';
  16825. context_menu = (0, _jquery2.default)(context_menu);
  16826. temp_op.append(context_menu);
  16827. context_menu.dropdown({
  16828. onChange: function onChange(value, text, $selectedItem) {
  16829. expression_element.itens[index_op] = value;
  16830. }
  16831. });
  16832. }
  16833. function renderMenuAddExpression(command, function_obj, el, dom_append_menu, expression_append_new_expression) {
  16834. if (el.hasClass("command_container") == false) {
  16835. var hier = el.parentsUntil(".commands_list_div");
  16836. for (var i = 0; i < hier.length; i++) {
  16837. if ((0, _jquery2.default)(hier[i]).hasClass("command_container")) {
  16838. el = (0, _jquery2.default)(hier[i]);
  16839. break;
  16840. }
  16841. }
  16842. }
  16843. if (dom_append_menu.hasClass("expression_elements") == false) {
  16844. var hier = el.parentsUntil(".commands_list_div");
  16845. for (var i = 0; i < hier.length; i++) {
  16846. if ((0, _jquery2.default)(hier[i]).hasClass("expression_elements")) {
  16847. dom_append_menu = (0, _jquery2.default)(hier[i]);
  16848. break;
  16849. }
  16850. }
  16851. }
  16852. var context_menu = '<div class="ui dropdown"><div class="text"></div><i class="ui icon arrow alternate circle right outline"></i><div class="menu">';
  16853. context_menu += '<div class="item" data-value="' + Models.EXPRESSION_ELEMENTS.exp_op_exp + '">EXP OP EXP</div>';
  16854. context_menu += '<div class="item" data-value="' + Models.EXPRESSION_ELEMENTS.op_exp + '">OP EXP</div>';
  16855. context_menu += '<div class="item" data-value="' + Models.EXPRESSION_ELEMENTS.par_exp_par + '">( EXP )</div>';
  16856. context_menu += '</div></div>';
  16857. context_menu = (0, _jquery2.default)(context_menu);
  16858. dom_append_menu.append(context_menu);
  16859. context_menu.dropdown({
  16860. onChange: function onChange(value, text, $selectedItem) {
  16861. switch (value) {
  16862. case Models.EXPRESSION_ELEMENTS.exp_op_exp:
  16863. 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)]);
  16864. expression_append_new_expression.push(exp);
  16865. break;
  16866. case Models.EXPRESSION_ELEMENTS.op_exp:
  16867. 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)]);
  16868. expression_append_new_expression.push(exp);
  16869. break;
  16870. case Models.EXPRESSION_ELEMENTS.par_exp_par:
  16871. var exp = new Models.ExpressionElement(Models.EXPRESSION_ELEMENTS.par_exp_par, [new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.all, null, null, null, true)]);
  16872. expression_append_new_expression.push(exp);
  16873. break;
  16874. }
  16875. renderExpressionElements(command, function_obj, el);
  16876. }
  16877. });
  16878. }
  16879. function renderElement(command, function_obj, el, expression_element) {
  16880. switch (expression_element.type_exp) {
  16881. case Models.EXPRESSION_ELEMENTS.exp_op_exp:
  16882. var temp_op = (0, _jquery2.default)('<div class="component_element"></div>');
  16883. var temp_exp_1 = (0, _jquery2.default)('<div class="component_element"></div>');
  16884. var temp_exp_2 = (0, _jquery2.default)('<div class="component_element"></div>');
  16885. el.append(temp_exp_1);
  16886. el.append(temp_op);
  16887. el.append(temp_exp_2);
  16888. if (expression_element.itens[0].type) {
  16889. VariableValueMenu.renderMenu(command, expression_element.itens[0], temp_exp_1, function_obj, 2, expression_element);
  16890. } else {
  16891. renderElement(command, function_obj, temp_exp_1, expression_element.itens[0]);
  16892. }
  16893. renderOperator(command, function_obj, temp_op, expression_element, 1);
  16894. if (expression_element.itens[2].type) {
  16895. VariableValueMenu.renderMenu(command, expression_element.itens[2], temp_exp_2, function_obj, 2, expression_element);
  16896. } else {
  16897. renderElement(command, function_obj, temp_exp_2, expression_element.itens[2]);
  16898. }
  16899. break;
  16900. case Models.EXPRESSION_ELEMENTS.op_exp:
  16901. var temp_op = (0, _jquery2.default)('<div class="component_element"></div>');
  16902. var temp_exp = (0, _jquery2.default)('<div class="component_element"></div>');
  16903. el.append(temp_op);
  16904. el.append(temp_exp);
  16905. renderOperator(command, function_obj, temp_op, expression_element, 0);
  16906. if (expression_element.itens[1].type) {
  16907. VariableValueMenu.renderMenu(command, expression_element.itens[1], temp_exp, function_obj, 2, expression_element);
  16908. } else {
  16909. renderElement(command, function_obj, temp_exp, expression_element.itens[1]);
  16910. }
  16911. break;
  16912. case Models.EXPRESSION_ELEMENTS.par_exp_par:
  16913. var temp_par_1 = (0, _jquery2.default)('<div class="component_element"> ( </div>');
  16914. var temp_exp = (0, _jquery2.default)('<div class="component_element"></div>');
  16915. var temp_par_2 = (0, _jquery2.default)('<div class="component_element"> ) </div>');
  16916. el.append(temp_par_1);
  16917. el.append(temp_exp);
  16918. for (var j = 0; j < expression_element.itens.length; j++) {
  16919. if (expression_element.itens[j].type) {
  16920. VariableValueMenu.renderMenu(command, expression_element.itens[j], temp_exp, function_obj, 2, expression_element);
  16921. } else {
  16922. renderElement(command, function_obj, temp_exp, expression_element.itens[j]);
  16923. }
  16924. }
  16925. //renderMenuAddExpression(command, function_obj, el, el, expression_element.itens);
  16926. el.append(temp_par_2);
  16927. break;
  16928. }
  16929. }
  16930. function renderExpression(command, function_obj, el) {
  16931. var expression_div = el.find('.expression_elements');
  16932. expression_div.text('');
  16933. var menu_add_item = (0, _jquery2.default)('<div class="menu_add_item"></div>');
  16934. menu_add_item.data('index_add', 0);
  16935. expression_div.append(menu_add_item);
  16936. for (var i = 0; i < command.expression.length; i++) {
  16937. if (command.expression[i].type) {
  16938. var temp = (0, _jquery2.default)('<div class="expression_element"></div>');
  16939. temp.data('ref_element', command.expression[i]);
  16940. temp.data('ref_index', i);
  16941. expression_div.append(temp);
  16942. VariableValueMenu.renderMenu(command, command.expression[i], temp, function_obj);
  16943. } else if (command.expression[i] == "(" || command.expression[i] == ")") {
  16944. var temp = (0, _jquery2.default)('<div class="expression_element">' + command.expression[i] + '</div>');
  16945. temp.data('ref_element', command.expression[i]);
  16946. temp.data('ref_index', i);
  16947. expression_div.append(temp);
  16948. } else {
  16949. var temp = '<div class="expression_element">';
  16950. switch (command.expression[i]) {
  16951. case Models.ARITHMETIC_TYPES.plus:
  16952. temp += '+';
  16953. break;
  16954. case Models.ARITHMETIC_TYPES.minus:
  16955. temp += '-';
  16956. break;
  16957. case Models.ARITHMETIC_TYPES.multiplication:
  16958. temp += '*';
  16959. break;
  16960. case Models.ARITHMETIC_TYPES.division:
  16961. temp += '/';
  16962. break;
  16963. case Models.ARITHMETIC_TYPES.module:
  16964. temp += '%';
  16965. break;
  16966. }
  16967. temp += '</div>';
  16968. temp = (0, _jquery2.default)(temp);
  16969. temp.data('ref_element', command.expression[i]);
  16970. temp.data('ref_index', i);
  16971. expression_div.append(temp);
  16972. }
  16973. var menu_add_item_seq = (0, _jquery2.default)('<div class="menu_add_item"></div>');
  16974. var index_temp = i + 1;
  16975. menu_add_item_seq.data('index_add', index_temp);
  16976. expression_div.append(menu_add_item_seq);
  16977. }
  16978. addMenuItens(command, function_obj, el);
  16979. }
  16980. function addMenuItens(command, function_obj, expression_div) {
  16981. var divs_expression = expression_div.find('.menu_add_item');
  16982. for (var i = 0; i < divs_expression.length; i++) {
  16983. var temp = (0, _jquery2.default)(divs_expression[i]).data('index_add');
  16984. var context_menu = '<div class="ui dropdown context_menu_clear"><i class="ui icon plus square outline"></i><div class="menu">';
  16985. context_menu += '<div class="item" data-option="value" data-index="' + temp + '">' + _localizedStringsService.LocalizedStrings.getUI('text_value') + '</div>';
  16986. context_menu += '<div class="item" data-option="operator" data-index="' + temp + '">' + _localizedStringsService.LocalizedStrings.getUI('text_operator') + '</div>';
  16987. context_menu += '<div class="item" data-option="parentheses" data-index="' + temp + '">' + _localizedStringsService.LocalizedStrings.getUI('text_parentheses') + '</div>';
  16988. context_menu += '</div></div>';
  16989. context_menu = (0, _jquery2.default)(context_menu);
  16990. (0, _jquery2.default)(divs_expression[i]).append(context_menu);
  16991. context_menu.dropdown({
  16992. on: 'hover',
  16993. onChange: function onChange(value, text, $selectedItem) {
  16994. switch ($selectedItem.data('option')) {
  16995. case "value":
  16996. command.expression.splice($selectedItem.data('index'), 0, new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.all, null, null, null, true));
  16997. renderExpression(command, function_obj, expression_div);
  16998. break;
  16999. case "operator":
  17000. command.expression.splice($selectedItem.data('index'), 0, Models.ARITHMETIC_TYPES.plus);
  17001. renderExpression(command, function_obj, expression_div);
  17002. break;
  17003. case "parentheses":
  17004. command.expression.splice($selectedItem.data('index'), 0, "(");
  17005. command.expression.splice($selectedItem.data('index') + 1, 0, new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.all, null, null, null, true));
  17006. command.expression.splice($selectedItem.data('index') + 2, 0, ")");
  17007. renderExpression(command, function_obj, expression_div);
  17008. break;
  17009. }
  17010. }
  17011. });
  17012. }
  17013. }
  17014. function addHandlers(command, function_obj, attribution_dom) {
  17015. attribution_dom.find('.button_remove_command').on('click', function () {
  17016. if (CommandsManagement.removeCommand(command, function_obj, attribution_dom)) {
  17017. attribution_dom.fadeOut();
  17018. }
  17019. });
  17020. attribution_dom.find('.button_refresh_attribution').on('click', function () {
  17021. renderExpressionElements(command, function_obj, attribution_dom);
  17022. });
  17023. }
  17024. function renderMenuOperations(command, ref_object, dom_object, menu_var_or_value, function_obj, variable_selected) {
  17025. /*console.log("recebido o seguinte DOM: ");
  17026. console.log(dom_object);
  17027. if (dom_object.hasClass('var_attributed')) {
  17028. return;
  17029. } else {
  17030. var hier = dom_object.parentsUntil(".command_container");
  17031. for (var i = 0; i < hier.length; i++) {
  17032. if ($(hier[i]).hasClass('var_attributed') || $(hier[i]).hasClass('parameters_function_called')) {
  17033. return;
  17034. }
  17035. }
  17036. }
  17037. dom_object.find('.context_menu_clear').remove();
  17038. var menu_operations = '<div class="ui dropdown menu_operations"><div class="text"></div><i class="dropdown icon"></i><div class="menu">';
  17039. for (var tm in Models.ARITHMETIC_TYPES) {
  17040. menu_operations += '<div class="item" data-option="'+tm+'">'+LocalizedStrings.getUI('btn_arithmetic_' + tm)+'</div>';
  17041. }
  17042. menu_operations += '<div class="item" data-option="clear">'+LocalizedStrings.getUI('btn_clear')+'</div>';
  17043. menu_operations += '</div></div>';
  17044. menu_operations = $(menu_operations);
  17045. dom_object.append(menu_operations);
  17046. menu_operations.dropdown({
  17047. onChange: function(value, text, $selectedItem) {
  17048. switch ($($selectedItem).data('option')) {
  17049. case "clear":
  17050. $(dom_object).text('');
  17051. VariableValueMenu.renderMenu(command, ref_object, dom_object, function_obj);
  17052. break;
  17053. default:
  17054. createExpressionAround(command, ref_object, dom_object, function_obj);
  17055. menu_operations.find('.text').text('');
  17056. }
  17057. }
  17058. });*/
  17059. }
  17060. function createExpressionAround(command, ref_object, dom_object, function_obj) {
  17061. (0, _jquery2.default)('<span> ( </span>').insertBefore(dom_object);
  17062. (0, _jquery2.default)('<span> ) </span>').insertAfter(dom_object);
  17063. VariableValueMenu.renderMenu(command, new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.all, null, null, null, true), dom_object, function_obj);
  17064. }
  17065. /***/ }),
  17066. /***/ "./js/visualUI/commands/break.js":
  17067. /*!***************************************!*\
  17068. !*** ./js/visualUI/commands/break.js ***!
  17069. \***************************************/
  17070. /*! no static exports found */
  17071. /***/ (function(module, exports, __webpack_require__) {
  17072. "use strict";
  17073. Object.defineProperty(exports, "__esModule", {
  17074. value: true
  17075. });
  17076. exports.createFloatingCommand = createFloatingCommand;
  17077. exports.renderCommand = renderCommand;
  17078. var _jquery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  17079. var _jquery2 = _interopRequireDefault(_jquery);
  17080. var _types = __webpack_require__(/*! ../types */ "./js/visualUI/types.js");
  17081. var _ivprog_elements = __webpack_require__(/*! ../ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  17082. var Models = _interopRequireWildcard(_ivprog_elements);
  17083. var _localizedStringsService = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  17084. var _commands = __webpack_require__(/*! ../commands */ "./js/visualUI/commands.js");
  17085. var CommandsManagement = _interopRequireWildcard(_commands);
  17086. 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; } }
  17087. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  17088. function createFloatingCommand() {
  17089. 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>');
  17090. }
  17091. function renderCommand(command, function_obj) {
  17092. 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>');
  17093. el.data('command', command);
  17094. addHandlers(command, function_obj, el);
  17095. return el;
  17096. }
  17097. function addHandlers(command, function_obj, break_dom) {
  17098. break_dom.find('.button_remove_command').on('click', function () {
  17099. if (CommandsManagement.removeCommand(command, function_obj, break_dom)) {
  17100. break_dom.fadeOut();
  17101. }
  17102. });
  17103. }
  17104. /***/ }),
  17105. /***/ "./js/visualUI/commands/comment.js":
  17106. /*!*****************************************!*\
  17107. !*** ./js/visualUI/commands/comment.js ***!
  17108. \*****************************************/
  17109. /*! no static exports found */
  17110. /***/ (function(module, exports, __webpack_require__) {
  17111. "use strict";
  17112. Object.defineProperty(exports, "__esModule", {
  17113. value: true
  17114. });
  17115. exports.createFloatingCommand = createFloatingCommand;
  17116. exports.renderCommand = renderCommand;
  17117. var _jquery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  17118. var _jquery2 = _interopRequireDefault(_jquery);
  17119. var _types = __webpack_require__(/*! ../types */ "./js/visualUI/types.js");
  17120. var _ivprog_elements = __webpack_require__(/*! ../ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  17121. var Models = _interopRequireWildcard(_ivprog_elements);
  17122. var _localizedStringsService = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  17123. var _globals = __webpack_require__(/*! ../globals */ "./js/visualUI/globals.js");
  17124. var GlobalsManagement = _interopRequireWildcard(_globals);
  17125. var _variables = __webpack_require__(/*! ../variables */ "./js/visualUI/variables.js");
  17126. var VariablesManagement = _interopRequireWildcard(_variables);
  17127. var _variable_value_menu = __webpack_require__(/*! ./variable_value_menu */ "./js/visualUI/commands/variable_value_menu.js");
  17128. var VariableValueMenu = _interopRequireWildcard(_variable_value_menu);
  17129. var _commands = __webpack_require__(/*! ../commands */ "./js/visualUI/commands.js");
  17130. var CommandsManagement = _interopRequireWildcard(_commands);
  17131. 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; } }
  17132. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  17133. function createFloatingCommand() {
  17134. 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>');
  17135. }
  17136. function renderCommand(command, function_obj) {
  17137. 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>');
  17138. el.data('command', command);
  17139. addHandlers(command, function_obj, el);
  17140. renderTextComment(command, function_obj, el);
  17141. return el;
  17142. }
  17143. function renderTextComment(command, function_obj, el) {
  17144. VariableValueMenu.renderMenu(command, command.comment_text, el.find('.var_value_menu_div'), function_obj, 20);
  17145. }
  17146. function addHandlers(command, function_obj, comment_dom) {
  17147. comment_dom.find('.button_remove_command').on('click', function () {
  17148. if (CommandsManagement.removeCommand(command, function_obj, comment_dom)) {
  17149. comment_dom.fadeOut();
  17150. }
  17151. });
  17152. }
  17153. /***/ }),
  17154. /***/ "./js/visualUI/commands/conditional_expression.js":
  17155. /*!********************************************************!*\
  17156. !*** ./js/visualUI/commands/conditional_expression.js ***!
  17157. \********************************************************/
  17158. /*! no static exports found */
  17159. /***/ (function(module, exports, __webpack_require__) {
  17160. "use strict";
  17161. Object.defineProperty(exports, "__esModule", {
  17162. value: true
  17163. });
  17164. exports.renderExpression = renderExpression;
  17165. var _jquery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  17166. var _jquery2 = _interopRequireDefault(_jquery);
  17167. var _types = __webpack_require__(/*! ../types */ "./js/visualUI/types.js");
  17168. var _ivprog_elements = __webpack_require__(/*! ../ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  17169. var Models = _interopRequireWildcard(_ivprog_elements);
  17170. var _localizedStringsService = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  17171. var _globals = __webpack_require__(/*! ../globals */ "./js/visualUI/globals.js");
  17172. var GlobalsManagement = _interopRequireWildcard(_globals);
  17173. var _variables = __webpack_require__(/*! ../variables */ "./js/visualUI/variables.js");
  17174. var VariablesManagement = _interopRequireWildcard(_variables);
  17175. var _variable_value_menu = __webpack_require__(/*! ./variable_value_menu */ "./js/visualUI/commands/variable_value_menu.js");
  17176. var VariableValueMenuManagement = _interopRequireWildcard(_variable_value_menu);
  17177. 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; } }
  17178. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  17179. function renderExpression(command, expression, function_obj, initial_el_to_render) {
  17180. expression.dom_object = initial_el_to_render;
  17181. if (expression.expression == null || expression.expression.length < 1) {
  17182. renderStartMenu(command, expression, function_obj, initial_el_to_render);
  17183. } else {
  17184. var main_div = (0, _jquery2.default)('<div class="expression_elements"></div>');
  17185. switch (expression.expression.type) {
  17186. case Models.EXPRESSION_TYPES.exp_logic:
  17187. renderLogicExpression(command, expression, expression.expression, function_obj, main_div, initial_el_to_render);
  17188. break;
  17189. case Models.EXPRESSION_TYPES.exp_arithmetic:
  17190. renderArithmeticExpression(command, expression, expression.expression, function_obj, main_div);
  17191. break;
  17192. }
  17193. initial_el_to_render.append(main_div);
  17194. var restartMenu = (0, _jquery2.default)('<div class="ui restart_expression"><i class="ui icon undo"></i></div>');
  17195. initial_el_to_render.append(restartMenu);
  17196. restartMenu.on('click', function (e) {
  17197. expression.expression = null;
  17198. initial_el_to_render.empty();
  17199. renderExpression(command, expression, function_obj, initial_el_to_render);
  17200. });
  17201. }
  17202. }
  17203. function renderArithmeticOperator(command, all_expression, expression_arithmetic, arithmetic_operator, function_obj, element_to_append) {
  17204. var menu_operator = (0, _jquery2.default)('<div class="ui dropdown"><div class="text"></div><i class="dropdown icon"></i></div>');
  17205. menu_operator.dropdown({
  17206. values: [{
  17207. name: '>',
  17208. value: Models.ARITHMETIC_COMPARISON.greater_than,
  17209. selected: arithmetic_operator == Models.ARITHMETIC_COMPARISON.greater_than
  17210. }, {
  17211. name: '<',
  17212. value: Models.ARITHMETIC_COMPARISON.less_than,
  17213. selected: arithmetic_operator == Models.ARITHMETIC_COMPARISON.less_than
  17214. }, {
  17215. name: '==',
  17216. value: Models.ARITHMETIC_COMPARISON.equals_to,
  17217. selected: arithmetic_operator == Models.ARITHMETIC_COMPARISON.equals_to
  17218. }, {
  17219. name: '!=',
  17220. value: Models.ARITHMETIC_COMPARISON.not_equals_to,
  17221. selected: arithmetic_operator == Models.ARITHMETIC_COMPARISON.not_equals_to
  17222. }, {
  17223. name: '>=',
  17224. value: Models.ARITHMETIC_COMPARISON.greater_than_or_equals_to,
  17225. selected: arithmetic_operator == Models.ARITHMETIC_COMPARISON.greater_than_or_equals_to
  17226. }, {
  17227. name: '<=',
  17228. value: Models.ARITHMETIC_COMPARISON.less_than_or_equals_to,
  17229. selected: arithmetic_operator == Models.ARITHMETIC_COMPARISON.less_than_or_equals_to
  17230. }],
  17231. onChange: function onChange(value, text, $selectedItem) {
  17232. expression_arithmetic.operator = value;
  17233. }
  17234. });
  17235. element_to_append.append(menu_operator);
  17236. }
  17237. function renderLogicOperator(command, all_expression, expression_logic, logic_operator, function_obj, element_to_append, initial_el_to_render) {
  17238. var menu_operator = (0, _jquery2.default)('<div class="ui dropdown"><div class="text"></div><i class="dropdown icon"></i></div>');
  17239. menu_operator.dropdown({
  17240. values: [{
  17241. name: '==',
  17242. value: Models.LOGIC_COMPARISON.equals_to,
  17243. selected: logic_operator == Models.LOGIC_COMPARISON.equals_to
  17244. }, {
  17245. name: '!=',
  17246. value: Models.LOGIC_COMPARISON.not_equals_to,
  17247. selected: logic_operator == Models.LOGIC_COMPARISON.not_equals_to
  17248. }, {
  17249. name: '&&',
  17250. value: Models.LOGIC_COMPARISON.and,
  17251. selected: logic_operator == Models.LOGIC_COMPARISON.and
  17252. }, {
  17253. name: '||',
  17254. value: Models.LOGIC_COMPARISON.or,
  17255. selected: logic_operator == Models.LOGIC_COMPARISON.or
  17256. }],
  17257. onChange: function onChange(value, text, $selectedItem) {
  17258. if ($selectedItem) {
  17259. expression_logic.operator = value;
  17260. if (expression_logic.second_operand == null) {
  17261. expression_logic.second_operand = new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.all, null, null, null, true);
  17262. initial_el_to_render.empty();
  17263. renderExpression(command, all_expression, function_obj, initial_el_to_render);
  17264. }
  17265. }
  17266. }
  17267. });
  17268. element_to_append.append(menu_operator);
  17269. }
  17270. function renderLogicExpression(command, all_expression, expression_logic, function_obj, element_to_append, initial_el_to_render) {
  17271. var exp_el_par_1 = (0, _jquery2.default)(' <span class="span_command_spec"> </span> ');
  17272. var exp_el_expr_el_1 = (0, _jquery2.default)('<div class="expression_element"></div>');
  17273. var exp_el_expr_operand = (0, _jquery2.default)('<div class="expression_element"></div>');
  17274. var exp_el_expr_el_2 = (0, _jquery2.default)('<div class="expression_element"></div>');
  17275. var exp_el_par_2 = (0, _jquery2.default)(' <span class="span_command_spec"> </span> ');
  17276. if (expression_logic.first_operand.type == Models.EXPRESSION_TYPES.exp_logic) {
  17277. renderLogicExpression(command, all_expression, expression_logic.first_operand, function_obj, exp_el_expr_el_1);
  17278. } else if (expression_logic.first_operand.type == Models.EXPRESSION_TYPES.exp_arithmetic) {
  17279. renderArithmeticExpression(command, all_expression, expression_logic.first_operand, function_obj, exp_el_expr_el_1);
  17280. } else {
  17281. VariableValueMenuManagement.renderMenu(command, expression_logic.first_operand, exp_el_expr_el_1, function_obj);
  17282. }
  17283. element_to_append.append(exp_el_par_1);
  17284. element_to_append.append(exp_el_expr_el_1);
  17285. renderLogicOperator(command, all_expression, expression_logic, expression_logic.operator, function_obj, exp_el_expr_operand, initial_el_to_render);
  17286. element_to_append.append(exp_el_expr_operand);
  17287. if (expression_logic.second_operand) {
  17288. if (expression_logic.second_operand.type == Models.EXPRESSION_TYPES.exp_logic) {
  17289. renderLogicExpression(command, all_expression, expression_logic.second_operand, function_obj, exp_el_expr_el_2);
  17290. } else if (expression_logic.second_operand.type == Models.EXPRESSION_TYPES.exp_arithmetic) {
  17291. renderArithmeticExpression(command, all_expression, expression_logic.second_operand, function_obj, exp_el_expr_el_2);
  17292. } else {
  17293. VariableValueMenuManagement.renderMenu(command, expression_logic.second_operand, exp_el_expr_el_2, function_obj);
  17294. }
  17295. element_to_append.append(exp_el_expr_el_2);
  17296. }
  17297. element_to_append.append(exp_el_par_2);
  17298. }
  17299. function renderArithmeticExpression(command, all_expression, expression_arithmetic, function_obj, element_to_append) {
  17300. var exp_el_par_1 = (0, _jquery2.default)(' <span class="span_command_spec"> </span> ');
  17301. var exp_el_expr_el_1 = (0, _jquery2.default)('<div class="expression_element"></div>');
  17302. var exp_el_expr_operand = (0, _jquery2.default)('<div class="expression_element"></div>');
  17303. var exp_el_expr_el_2 = (0, _jquery2.default)('<div class="expression_element"></div>');
  17304. var exp_el_par_2 = (0, _jquery2.default)(' <span class="span_command_spec"> </span> ');
  17305. if (expression_arithmetic.first_operand.type == Models.EXPRESSION_TYPES.exp_logic) {
  17306. renderLogicExpression(command, all_expression, expression_arithmetic.first_operand, function_obj, exp_el_expr_el_1);
  17307. } else if (expression_arithmetic.first_operand.type == Models.EXPRESSION_TYPES.exp_arithmetic) {
  17308. renderArithmeticExpression(command, all_expression, expression_arithmetic.first_operand, function_obj, exp_el_expr_el_1);
  17309. } else {
  17310. VariableValueMenuManagement.renderMenu(command, expression_arithmetic.first_operand, exp_el_expr_el_1, function_obj);
  17311. }
  17312. if (expression_arithmetic.second_operand.type == Models.EXPRESSION_TYPES.exp_logic) {
  17313. renderLogicExpression(command, all_expression, expression_arithmetic.second_operand, function_obj, exp_el_expr_el_2);
  17314. } else if (expression_arithmetic.second_operand.type == Models.EXPRESSION_TYPES.exp_arithmetic) {
  17315. renderArithmeticExpression(command, all_expression, expression_arithmetic.second_operand, function_obj, exp_el_expr_el_2);
  17316. } else {
  17317. VariableValueMenuManagement.renderMenu(command, expression_arithmetic.second_operand, exp_el_expr_el_2, function_obj);
  17318. }
  17319. renderArithmeticOperator(command, all_expression, expression_arithmetic, expression_arithmetic.operator, function_obj, exp_el_expr_operand);
  17320. element_to_append.append(exp_el_par_1);
  17321. element_to_append.append(exp_el_expr_el_1);
  17322. element_to_append.append(exp_el_expr_operand);
  17323. element_to_append.append(exp_el_expr_el_2);
  17324. element_to_append.append(exp_el_par_2);
  17325. }
  17326. function renderStartMenu(command, expression, function_obj, initial_el_to_render) {
  17327. var start_menu = '';
  17328. 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">';
  17329. start_menu += '<div class="item" data-exp="' + Models.EXPRESSION_TYPES.exp_logic + '">' + _localizedStringsService.LocalizedStrings.getUI('text_logic_expression') + ' (EL == EL and EL)</div>';
  17330. start_menu += '<div class="item" data-exp="' + Models.EXPRESSION_TYPES.exp_arithmetic + '">' + _localizedStringsService.LocalizedStrings.getUI('text_arithmetic_expression') + ' (EA < EA)</div>';
  17331. start_menu += '</div></div>';
  17332. start_menu = (0, _jquery2.default)(start_menu);
  17333. start_menu.dropdown({
  17334. onChange: function onChange(value, text, $selectedItem) {
  17335. switch ($selectedItem.data('exp')) {
  17336. case Models.EXPRESSION_TYPES.exp_logic:
  17337. expression.expression = new Models.LogicExpression(false, new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.all, null, null, null, true));
  17338. break;
  17339. case Models.EXPRESSION_TYPES.exp_arithmetic:
  17340. 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);
  17341. break;
  17342. }
  17343. initial_el_to_render.html('');
  17344. renderExpression(command, expression, function_obj, initial_el_to_render);
  17345. },
  17346. selectOnKeydown: false
  17347. });
  17348. initial_el_to_render.append(' <span class="span_command_spec"> </span> ');
  17349. initial_el_to_render.append(start_menu);
  17350. initial_el_to_render.append(' <span class="span_command_spec"> </span> ');
  17351. }
  17352. /***/ }),
  17353. /***/ "./js/visualUI/commands/contextualized_menu.js":
  17354. /*!*****************************************************!*\
  17355. !*** ./js/visualUI/commands/contextualized_menu.js ***!
  17356. \*****************************************************/
  17357. /*! no static exports found */
  17358. /***/ (function(module, exports, __webpack_require__) {
  17359. "use strict";
  17360. Object.defineProperty(exports, "__esModule", {
  17361. value: true
  17362. });
  17363. exports.renderMenu = renderMenu;
  17364. var _jquery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  17365. var _jquery2 = _interopRequireDefault(_jquery);
  17366. var _types = __webpack_require__(/*! ../types */ "./js/visualUI/types.js");
  17367. var _ivprog_elements = __webpack_require__(/*! ../ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  17368. var Models = _interopRequireWildcard(_ivprog_elements);
  17369. var _localizedStringsService = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  17370. var _commands = __webpack_require__(/*! ../commands */ "./js/visualUI/commands.js");
  17371. var CommandsManagement = _interopRequireWildcard(_commands);
  17372. var _variable_value_menu = __webpack_require__(/*! ./variable_value_menu */ "./js/visualUI/commands/variable_value_menu.js");
  17373. var VariableValueMenuManagement = _interopRequireWildcard(_variable_value_menu);
  17374. var _switch = __webpack_require__(/*! ./switch */ "./js/visualUI/commands/switch.js");
  17375. var SwitchManagement = _interopRequireWildcard(_switch);
  17376. var _repeatNtimes = __webpack_require__(/*! ./repeatNtimes */ "./js/visualUI/commands/repeatNtimes.js");
  17377. var RepeatNTimesManagement = _interopRequireWildcard(_repeatNtimes);
  17378. 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; } }
  17379. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  17380. function renderMenu(command, dom_where_render, function_obj, dom_command) {
  17381. var menu_div = '<div class="ui dropdown menu_commands" ><i class="icon code"></i> <div class="menu"> ';
  17382. if (command.type == Models.COMMAND_TYPES.repeatNtimes || command.type == Models.COMMAND_TYPES.whiletrue || command.type == Models.COMMAND_TYPES.dowhiletrue) {
  17383. menu_div += '<a class="item" data-command="' + Models.COMMAND_TYPES.break + '"><i class="download icon"></i> ' + _localizedStringsService.LocalizedStrings.getUI('btn_break') + ' </a>';
  17384. } else {
  17385. menu_div += '<a class="item" data-command="' + Models.COMMAND_TYPES.break + '"><i class="download icon"></i> ' + _localizedStringsService.LocalizedStrings.getUI('btn_break') + ' </a>';
  17386. menu_div += '<a class="item" data-command="' + Models.COMMAND_TYPES.switchcase + '"><i class="download icon"></i> ' + _localizedStringsService.LocalizedStrings.getUI('btn_case') + ' </a>';
  17387. }
  17388. menu_div += '</div></div>';
  17389. menu_div = (0, _jquery2.default)(menu_div);
  17390. dom_where_render.append(menu_div);
  17391. addHandlers(command, dom_where_render, function_obj, dom_command);
  17392. }
  17393. function addHandlers(command, dom_where_render, function_obj, dom_command) {
  17394. console.log('command, dom_where_render, function_obj, dom_command');
  17395. console.log(command, dom_where_render, function_obj, dom_command);
  17396. console.log(dom_where_render.parents());
  17397. dom_where_render.find('.menu_commands').dropdown({
  17398. on: 'hover'
  17399. });
  17400. dom_where_render.find('.menu_commands a').on('click', function (evt) {
  17401. if (command.type == Models.COMMAND_TYPES.repeatNtimes || command.type == Models.COMMAND_TYPES.whiletrue || command.type == Models.COMMAND_TYPES.dowhiletrue) {
  17402. if (command.commands_block == null || command.commands_block.length == 0) {
  17403. command.commands_block = [];
  17404. var new_cmd = CommandsManagement.genericCreateCommand((0, _jquery2.default)(this).data('command'));
  17405. command.commands_block.push(new_cmd);
  17406. CommandsManagement.renderCommand(new_cmd, dom_command.find('.block_commands'), 3, function_obj);
  17407. } else {
  17408. CommandsManagement.createFloatingCommand(function_obj, dom_command.find('.block_commands'), (0, _jquery2.default)(this).data('command'), evt);
  17409. }
  17410. } else {
  17411. switch ((0, _jquery2.default)(this).data('command')) {
  17412. case Models.COMMAND_TYPES.break:
  17413. CommandsManagement.createFloatingCommand(function_obj, dom_command.find('.block_commands'), (0, _jquery2.default)(this).data('command'), evt);
  17414. break;
  17415. case Models.COMMAND_TYPES.switchcase:
  17416. addCaseToSwitch(command, dom_where_render, function_obj, dom_command);
  17417. break;
  17418. }
  17419. }
  17420. });
  17421. }
  17422. function addCaseToSwitch(command, dom_where_render, function_obj, dom_command) {
  17423. if (command.cases == null) {
  17424. command.cases = [];
  17425. }
  17426. var sc = new Models.SwitchCase(new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.all, null, null, null, true));
  17427. command.cases.push(sc);
  17428. SwitchManagement.renderCase(sc, command, function_obj, dom_command.find('.all_cases_div'));
  17429. }
  17430. /***/ }),
  17431. /***/ "./js/visualUI/commands/dowhiletrue.js":
  17432. /*!*********************************************!*\
  17433. !*** ./js/visualUI/commands/dowhiletrue.js ***!
  17434. \*********************************************/
  17435. /*! no static exports found */
  17436. /***/ (function(module, exports, __webpack_require__) {
  17437. "use strict";
  17438. Object.defineProperty(exports, "__esModule", {
  17439. value: true
  17440. });
  17441. exports.createFloatingCommand = createFloatingCommand;
  17442. exports.renderCommand = renderCommand;
  17443. var _jquery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  17444. var _jquery2 = _interopRequireDefault(_jquery);
  17445. var _types = __webpack_require__(/*! ../types */ "./js/visualUI/types.js");
  17446. var _ivprog_elements = __webpack_require__(/*! ../ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  17447. var Models = _interopRequireWildcard(_ivprog_elements);
  17448. var _localizedStringsService = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  17449. var _globals = __webpack_require__(/*! ../globals */ "./js/visualUI/globals.js");
  17450. var GlobalsManagement = _interopRequireWildcard(_globals);
  17451. var _variables = __webpack_require__(/*! ../variables */ "./js/visualUI/variables.js");
  17452. var VariablesManagement = _interopRequireWildcard(_variables);
  17453. var _commands = __webpack_require__(/*! ../commands */ "./js/visualUI/commands.js");
  17454. var CommandsManagement = _interopRequireWildcard(_commands);
  17455. var _conditional_expression = __webpack_require__(/*! ./conditional_expression */ "./js/visualUI/commands/conditional_expression.js");
  17456. var ConditionalExpressionManagement = _interopRequireWildcard(_conditional_expression);
  17457. var _contextualized_menu = __webpack_require__(/*! ./contextualized_menu */ "./js/visualUI/commands/contextualized_menu.js");
  17458. var ContextualizedMenu = _interopRequireWildcard(_contextualized_menu);
  17459. 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; } }
  17460. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  17461. function createFloatingCommand() {
  17462. 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>');
  17463. }
  17464. function renderCommand(command, function_obj) {
  17465. var ret = '';
  17466. 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>';
  17467. ret += '<div class="ui block_commands" data-subblock="" data-idcommand="">';
  17468. ret += '</div>';
  17469. 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>';
  17470. ret += '</div>';
  17471. var el = (0, _jquery2.default)(ret);
  17472. el.data('command', command);
  17473. el.find('.block_commands').data('command', command);
  17474. addHandlers(command, function_obj, el);
  17475. ContextualizedMenu.renderMenu(command, el.find('.context_menu'), function_obj, el);
  17476. ConditionalExpressionManagement.renderExpression(command, command.expression, function_obj, el.find('.conditional_expression'));
  17477. if (command.commands_block) {
  17478. for (var j = 0; j < command.commands_block.length; j++) {
  17479. CommandsManagement.renderCommand(command.commands_block[j], (0, _jquery2.default)(el.find('.block_commands')[0]), 3, function_obj);
  17480. }
  17481. }
  17482. return el;
  17483. }
  17484. function addHandlers(command, function_obj, dowhiletrue_dom) {
  17485. dowhiletrue_dom.find('.button_remove_command').on('click', function () {
  17486. if (CommandsManagement.removeCommand(command, function_obj, dowhiletrue_dom)) {
  17487. dowhiletrue_dom.fadeOut();
  17488. }
  17489. });
  17490. }
  17491. /***/ }),
  17492. /***/ "./js/visualUI/commands/functioncall.js":
  17493. /*!**********************************************!*\
  17494. !*** ./js/visualUI/commands/functioncall.js ***!
  17495. \**********************************************/
  17496. /*! no static exports found */
  17497. /***/ (function(module, exports, __webpack_require__) {
  17498. "use strict";
  17499. Object.defineProperty(exports, "__esModule", {
  17500. value: true
  17501. });
  17502. exports.createFloatingCommand = createFloatingCommand;
  17503. exports.renderCommand = renderCommand;
  17504. var _jquery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  17505. var _jquery2 = _interopRequireDefault(_jquery);
  17506. var _types = __webpack_require__(/*! ../types */ "./js/visualUI/types.js");
  17507. var _ivprog_elements = __webpack_require__(/*! ../ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  17508. var Models = _interopRequireWildcard(_ivprog_elements);
  17509. var _localizedStringsService = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  17510. var _globals = __webpack_require__(/*! ../globals */ "./js/visualUI/globals.js");
  17511. var GlobalsManagement = _interopRequireWildcard(_globals);
  17512. var _variables = __webpack_require__(/*! ../variables */ "./js/visualUI/variables.js");
  17513. var VariablesManagement = _interopRequireWildcard(_variables);
  17514. var _variable_value_menu = __webpack_require__(/*! ./variable_value_menu */ "./js/visualUI/commands/variable_value_menu.js");
  17515. var VariableValueMenu = _interopRequireWildcard(_variable_value_menu);
  17516. var _commands = __webpack_require__(/*! ../commands */ "./js/visualUI/commands.js");
  17517. var CommandsManagement = _interopRequireWildcard(_commands);
  17518. 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; } }
  17519. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  17520. function createFloatingCommand() {
  17521. return (0, _jquery2.default)('<div class="ui functioncall created_element"> <i class="hand point right icon"></i> <span> funcao() </span></div>');
  17522. }
  17523. function renderCommand(command, function_obj) {
  17524. 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>');
  17525. el.data('command', command);
  17526. VariableValueMenu.renderMenu(command, command.function_called, el.find('.var_value_menu_div'), function_obj);
  17527. addHandlers(command, function_obj, el);
  17528. return el;
  17529. }
  17530. function addHandlers(command, function_obj, functioncall_dom) {
  17531. functioncall_dom.find('.button_remove_command').on('click', function () {
  17532. if (CommandsManagement.removeCommand(command, function_obj, functioncall_dom)) {
  17533. functioncall_dom.fadeOut();
  17534. }
  17535. });
  17536. }
  17537. /***/ }),
  17538. /***/ "./js/visualUI/commands/iftrue.js":
  17539. /*!****************************************!*\
  17540. !*** ./js/visualUI/commands/iftrue.js ***!
  17541. \****************************************/
  17542. /*! no static exports found */
  17543. /***/ (function(module, exports, __webpack_require__) {
  17544. "use strict";
  17545. Object.defineProperty(exports, "__esModule", {
  17546. value: true
  17547. });
  17548. exports.createFloatingCommand = createFloatingCommand;
  17549. exports.renderCommand = renderCommand;
  17550. var _jquery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  17551. var _jquery2 = _interopRequireDefault(_jquery);
  17552. var _types = __webpack_require__(/*! ../types */ "./js/visualUI/types.js");
  17553. var _ivprog_elements = __webpack_require__(/*! ../ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  17554. var Models = _interopRequireWildcard(_ivprog_elements);
  17555. var _localizedStringsService = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  17556. var _globals = __webpack_require__(/*! ../globals */ "./js/visualUI/globals.js");
  17557. var GlobalsManagement = _interopRequireWildcard(_globals);
  17558. var _variables = __webpack_require__(/*! ../variables */ "./js/visualUI/variables.js");
  17559. var VariablesManagement = _interopRequireWildcard(_variables);
  17560. var _commands = __webpack_require__(/*! ../commands */ "./js/visualUI/commands.js");
  17561. var CommandsManagement = _interopRequireWildcard(_commands);
  17562. var _conditional_expression = __webpack_require__(/*! ./conditional_expression */ "./js/visualUI/commands/conditional_expression.js");
  17563. var ConditionalExpressionManagement = _interopRequireWildcard(_conditional_expression);
  17564. 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; } }
  17565. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  17566. function createFloatingCommand() {
  17567. return (0, _jquery2.default)('<div class="ui iftrue created_element"> <i class="ui icon small random"></i> <span> if (x < 1) { } </span></div>');
  17568. }
  17569. function renderCommand(command, function_obj) {
  17570. var ret = '';
  17571. 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>';
  17572. ret += '<span class="span_command_spec"> ' + _localizedStringsService.LocalizedStrings.getUI('text_if') + '</span>';
  17573. ret += ' <span class="span_command_spec"> ( </span> <div class="conditional_expression"></div> <span class="span_command_spec"> ) </span>';
  17574. ret += '<span> </span> ';
  17575. ret += '<div class="ui block_commands commands_if conditional_comands_block" data-if="true">';
  17576. ret += '</div></div>';
  17577. ret += '<div class="ui data_block_else" data-else="true"> <span class="span_command_spec"> ' + _localizedStringsService.LocalizedStrings.getUI('text_else') + ' </span>';
  17578. ret += '<div class="ui block_commands commands_else conditional_comands_block" data-else="true">';
  17579. ret += '</div>';
  17580. ret += '<span></span></div>';
  17581. ret += '</div>';
  17582. var el = (0, _jquery2.default)(ret);
  17583. el.data('command', command);
  17584. el.find('.block_commands').data('command', command);
  17585. el.find('.data_block_if').data('command', command);
  17586. el.find('.data_block_else').data('command', command);
  17587. el.find('.commands_if').data('command', command);
  17588. addHandlers(command, function_obj, el);
  17589. ConditionalExpressionManagement.renderExpression(command, command.expression, function_obj, el.find('.conditional_expression'));
  17590. if (command.commands_block) {
  17591. for (var j = 0; j < command.commands_block.length; j++) {
  17592. CommandsManagement.renderCommand(command.commands_block[j], (0, _jquery2.default)(el.find('.commands_if')[0]), 3, function_obj);
  17593. }
  17594. }
  17595. if (command.commands_else) {
  17596. for (var j = 0; j < command.commands_else.length; j++) {
  17597. CommandsManagement.renderCommand(command.commands_else[j], (0, _jquery2.default)(el.find('.commands_else')[0]), 3, function_obj);
  17598. }
  17599. }
  17600. return el;
  17601. }
  17602. function addHandlers(command, function_obj, iftrue_dom) {
  17603. iftrue_dom.find('.button_remove_command').on('click', function () {
  17604. if (CommandsManagement.removeCommand(command, function_obj, iftrue_dom)) {
  17605. iftrue_dom.fadeOut();
  17606. }
  17607. });
  17608. }
  17609. /***/ }),
  17610. /***/ "./js/visualUI/commands/reader.js":
  17611. /*!****************************************!*\
  17612. !*** ./js/visualUI/commands/reader.js ***!
  17613. \****************************************/
  17614. /*! no static exports found */
  17615. /***/ (function(module, exports, __webpack_require__) {
  17616. "use strict";
  17617. Object.defineProperty(exports, "__esModule", {
  17618. value: true
  17619. });
  17620. exports.createFloatingCommand = createFloatingCommand;
  17621. exports.renderCommand = renderCommand;
  17622. var _jquery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  17623. var _jquery2 = _interopRequireDefault(_jquery);
  17624. var _types = __webpack_require__(/*! ../types */ "./js/visualUI/types.js");
  17625. var _ivprog_elements = __webpack_require__(/*! ../ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  17626. var Models = _interopRequireWildcard(_ivprog_elements);
  17627. var _localizedStringsService = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  17628. var _globals = __webpack_require__(/*! ../globals */ "./js/visualUI/globals.js");
  17629. var GlobalsManagement = _interopRequireWildcard(_globals);
  17630. var _variables = __webpack_require__(/*! ../variables */ "./js/visualUI/variables.js");
  17631. var VariablesManagement = _interopRequireWildcard(_variables);
  17632. var _variable_value_menu = __webpack_require__(/*! ./variable_value_menu */ "./js/visualUI/commands/variable_value_menu.js");
  17633. var VariableValueMenu = _interopRequireWildcard(_variable_value_menu);
  17634. var _commands = __webpack_require__(/*! ../commands */ "./js/visualUI/commands.js");
  17635. var CommandsManagement = _interopRequireWildcard(_commands);
  17636. 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; } }
  17637. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  17638. function createFloatingCommand() {
  17639. 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>');
  17640. }
  17641. function renderCommand(command, function_obj) {
  17642. 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>';
  17643. el = (0, _jquery2.default)(el);
  17644. el.data('command', command);
  17645. VariableValueMenu.renderMenu(command, command.variable_value_menu, el.find('.var_value_menu_div'), function_obj);
  17646. addHandlers(command, function_obj, el);
  17647. return el;
  17648. }
  17649. function addHandlers(command, function_obj, reader_dom) {
  17650. reader_dom.find('.button_remove_command').on('click', function () {
  17651. if (CommandsManagement.removeCommand(command, function_obj, reader_dom)) {
  17652. reader_dom.fadeOut();
  17653. }
  17654. });
  17655. }
  17656. /***/ }),
  17657. /***/ "./js/visualUI/commands/repeatNtimes.js":
  17658. /*!**********************************************!*\
  17659. !*** ./js/visualUI/commands/repeatNtimes.js ***!
  17660. \**********************************************/
  17661. /*! no static exports found */
  17662. /***/ (function(module, exports, __webpack_require__) {
  17663. "use strict";
  17664. Object.defineProperty(exports, "__esModule", {
  17665. value: true
  17666. });
  17667. exports.createFloatingCommand = createFloatingCommand;
  17668. exports.renderCommand = renderCommand;
  17669. exports.manageExpressionElements = manageExpressionElements;
  17670. exports.manageClearExpressionElements = manageClearExpressionElements;
  17671. var _jquery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  17672. var _jquery2 = _interopRequireDefault(_jquery);
  17673. var _types = __webpack_require__(/*! ../types */ "./js/visualUI/types.js");
  17674. var _ivprog_elements = __webpack_require__(/*! ../ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  17675. var Models = _interopRequireWildcard(_ivprog_elements);
  17676. var _localizedStringsService = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  17677. var _globals = __webpack_require__(/*! ../globals */ "./js/visualUI/globals.js");
  17678. var GlobalsManagement = _interopRequireWildcard(_globals);
  17679. var _variables = __webpack_require__(/*! ../variables */ "./js/visualUI/variables.js");
  17680. var VariablesManagement = _interopRequireWildcard(_variables);
  17681. var _commands = __webpack_require__(/*! ../commands */ "./js/visualUI/commands.js");
  17682. var CommandsManagement = _interopRequireWildcard(_commands);
  17683. var _conditional_expression = __webpack_require__(/*! ./conditional_expression */ "./js/visualUI/commands/conditional_expression.js");
  17684. var ConditionalExpressionManagement = _interopRequireWildcard(_conditional_expression);
  17685. var _variable_value_menu = __webpack_require__(/*! ./variable_value_menu */ "./js/visualUI/commands/variable_value_menu.js");
  17686. var VariableValueMenu = _interopRequireWildcard(_variable_value_menu);
  17687. var _contextualized_menu = __webpack_require__(/*! ./contextualized_menu */ "./js/visualUI/commands/contextualized_menu.js");
  17688. var ContextualizedMenu = _interopRequireWildcard(_contextualized_menu);
  17689. 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; } }
  17690. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  17691. function createFloatingCommand() {
  17692. 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>');
  17693. }
  17694. function renderCommand(command, function_obj) {
  17695. 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>';
  17696. ret += '<div class="ui block_commands">';
  17697. ret += '</div>';
  17698. ret += '<span> </span>';
  17699. ret += '</div>';
  17700. var el = (0, _jquery2.default)(ret);
  17701. el.data('command', command);
  17702. el.find('.block_commands').data('command', command);
  17703. addHandlers(command, function_obj, el);
  17704. ContextualizedMenu.renderMenu(command, el.find('.context_menu'), function_obj, el);
  17705. VariableValueMenu.renderMenu(command, command.var_attribution, el.find('.variable_attribution'), function_obj);
  17706. ConditionalExpressionManagement.renderExpression(command, command.expression2, function_obj, el.find('.conditional_expression'));
  17707. VariableValueMenu.renderMenu(command, command.var_incrementation, el.find('.incrementation_variable'), function_obj);
  17708. if (command.expression1) {
  17709. el.find('.text_receives').text(_localizedStringsService.LocalizedStrings.getUI('text_receives'));
  17710. VariableValueMenu.renderMenu(command, command.expression1, el.find('.var_value_expression'), function_obj);
  17711. }
  17712. if (command.expression3) {
  17713. el.find('.text_inc_receives').text(_localizedStringsService.LocalizedStrings.getUI('text_receives'));
  17714. VariableValueMenu.renderMenu(command, command.expression3.itens[0], el.find('.first_operand'), function_obj);
  17715. renderOperator(command, function_obj, el.find('.operator'), command.expression3, 1);
  17716. VariableValueMenu.renderMenu(command, command.expression3.itens[2], el.find('.second_operand'), function_obj);
  17717. }
  17718. if (command.commands_block) {
  17719. for (var j = 0; j < command.commands_block.length; j++) {
  17720. CommandsManagement.renderCommand(command.commands_block[j], (0, _jquery2.default)(el.find('.block_commands')[0]), 3, function_obj);
  17721. }
  17722. }
  17723. return el;
  17724. }
  17725. function manageExpressionElements(command, ref_object, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element) {
  17726. if (dom_object.hasClass('variable_attribution')) {
  17727. if (!command.expression3) {
  17728. 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)]);
  17729. command.expression3 = exp;
  17730. command.var_incrementation = command.var_attribution;
  17731. 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);
  17732. command.expression2.expression = cond_exp;
  17733. }
  17734. dom_object.parent().find('.text_receives').text(_localizedStringsService.LocalizedStrings.getUI('text_receives'));
  17735. command.expression1 = new Models.VariableValueMenu(VariableValueMenu.VAR_OR_VALUE_TYPES.all, "0", null, null, true);
  17736. dom_object.parent().find('.var_value_expression').empty();
  17737. VariableValueMenu.renderMenu(command, command.expression1, dom_object.parent().find('.var_value_expression'), function_obj);
  17738. renderAlgorithm();
  17739. }
  17740. if (dom_object.hasClass('incrementation_variable')) {
  17741. dom_object.parent().find('.text_inc_receives').text(_localizedStringsService.LocalizedStrings.getUI('text_receives'));
  17742. 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)]);
  17743. command.expression3 = exp;
  17744. VariableValueMenu.renderMenu(command, command.expression3.itens[0], dom_object.parent().find('.first_operand'), function_obj);
  17745. renderOperator(command, function_obj, dom_object.parent().find('.operator'), command.expression3, 1);
  17746. VariableValueMenu.renderMenu(command, command.expression3.itens[2], dom_object.parent().find('.second_operand'), function_obj);
  17747. }
  17748. }
  17749. function manageClearExpressionElements(command, ref_object, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element) {
  17750. if (dom_object.hasClass('variable_attribution')) {
  17751. (0, _jquery2.default)(dom_object).parent().find('.text_receives').text('');
  17752. command.expression1 = null;
  17753. (0, _jquery2.default)(dom_object).parent().find('.var_value_expression').empty();
  17754. }
  17755. if (dom_object.hasClass('incrementation_variable')) {
  17756. (0, _jquery2.default)(dom_object).parent().find('.text_inc_receives').text('');
  17757. command.expression3 = null;
  17758. (0, _jquery2.default)(dom_object).parent().find('.first_operand').empty();
  17759. (0, _jquery2.default)(dom_object).parent().find('.operator').empty();
  17760. (0, _jquery2.default)(dom_object).parent().find('.second_operand').empty();
  17761. }
  17762. }
  17763. function addHandlers(command, function_obj, repeatNtimes_dom) {
  17764. repeatNtimes_dom.find('.button_remove_command').on('click', function () {
  17765. if (CommandsManagement.removeCommand(command, function_obj, repeatNtimes_dom)) {
  17766. repeatNtimes_dom.fadeOut();
  17767. }
  17768. });
  17769. }
  17770. function renderOperator(command, function_obj, temp_op, expression_element, index_op) {
  17771. var menu_operator = (0, _jquery2.default)('<div class="ui dropdown"><div class="text"></div></div>');
  17772. menu_operator.dropdown({
  17773. values: [{
  17774. name: '+',
  17775. value: Models.ARITHMETIC_TYPES.plus,
  17776. selected: expression_element.itens[index_op] == Models.ARITHMETIC_TYPES.plus
  17777. }, {
  17778. name: '-',
  17779. value: Models.ARITHMETIC_TYPES.minus,
  17780. selected: expression_element.itens[index_op] == Models.ARITHMETIC_TYPES.minus
  17781. }, {
  17782. name: '*',
  17783. value: Models.ARITHMETIC_TYPES.multiplication,
  17784. selected: expression_element.itens[index_op] == Models.ARITHMETIC_TYPES.multiplication
  17785. }, {
  17786. name: '/',
  17787. value: Models.ARITHMETIC_TYPES.division,
  17788. selected: expression_element.itens[index_op] == Models.ARITHMETIC_TYPES.division
  17789. }, {
  17790. name: '%',
  17791. value: Models.ARITHMETIC_TYPES.module,
  17792. selected: expression_element.itens[index_op] == Models.ARITHMETIC_TYPES.module
  17793. }],
  17794. onChange: function onChange(value, text, $selectedItem) {
  17795. expression_element.itens[index_op] = value;
  17796. }
  17797. });
  17798. temp_op.append(menu_operator);
  17799. }
  17800. /***/ }),
  17801. /***/ "./js/visualUI/commands/return.js":
  17802. /*!****************************************!*\
  17803. !*** ./js/visualUI/commands/return.js ***!
  17804. \****************************************/
  17805. /*! no static exports found */
  17806. /***/ (function(module, exports, __webpack_require__) {
  17807. "use strict";
  17808. Object.defineProperty(exports, "__esModule", {
  17809. value: true
  17810. });
  17811. exports.createFloatingCommand = createFloatingCommand;
  17812. exports.renderCommand = renderCommand;
  17813. var _jquery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  17814. var _jquery2 = _interopRequireDefault(_jquery);
  17815. var _types = __webpack_require__(/*! ../types */ "./js/visualUI/types.js");
  17816. var _ivprog_elements = __webpack_require__(/*! ../ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  17817. var Models = _interopRequireWildcard(_ivprog_elements);
  17818. var _localizedStringsService = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  17819. var _globals = __webpack_require__(/*! ../globals */ "./js/visualUI/globals.js");
  17820. var GlobalsManagement = _interopRequireWildcard(_globals);
  17821. var _variables = __webpack_require__(/*! ../variables */ "./js/visualUI/variables.js");
  17822. var VariablesManagement = _interopRequireWildcard(_variables);
  17823. var _variable_value_menu = __webpack_require__(/*! ./variable_value_menu */ "./js/visualUI/commands/variable_value_menu.js");
  17824. var VariableValueMenu = _interopRequireWildcard(_variable_value_menu);
  17825. var _commands = __webpack_require__(/*! ../commands */ "./js/visualUI/commands.js");
  17826. var CommandsManagement = _interopRequireWildcard(_commands);
  17827. 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; } }
  17828. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  17829. function createFloatingCommand() {
  17830. 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>');
  17831. }
  17832. function renderCommand(command, function_obj) {
  17833. 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>');
  17834. el.data('command', command);
  17835. addHandlers(command, function_obj, el);
  17836. if (function_obj.return_type != _types.Types.VOID) {
  17837. VariableValueMenu.renderMenu(command, command.variable_value_menu, el.find('.var_value_menu_div'), function_obj);
  17838. } else {
  17839. el.find('.var_value_menu_div').remove();
  17840. command.variable_value_menu = null;
  17841. }
  17842. return el;
  17843. }
  17844. function addHandlers(command, function_obj, return_dom) {
  17845. return_dom.find('.button_remove_command').on('click', function () {
  17846. if (CommandsManagement.removeCommand(command, function_obj, return_dom)) {
  17847. return_dom.fadeOut();
  17848. }
  17849. });
  17850. }
  17851. /***/ }),
  17852. /***/ "./js/visualUI/commands/switch.js":
  17853. /*!****************************************!*\
  17854. !*** ./js/visualUI/commands/switch.js ***!
  17855. \****************************************/
  17856. /*! no static exports found */
  17857. /***/ (function(module, exports, __webpack_require__) {
  17858. "use strict";
  17859. Object.defineProperty(exports, "__esModule", {
  17860. value: true
  17861. });
  17862. exports.createFloatingCommand = createFloatingCommand;
  17863. exports.renderCommand = renderCommand;
  17864. exports.renderCase = renderCase;
  17865. var _jquery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  17866. var _jquery2 = _interopRequireDefault(_jquery);
  17867. var _types = __webpack_require__(/*! ../types */ "./js/visualUI/types.js");
  17868. var _ivprog_elements = __webpack_require__(/*! ../ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  17869. var Models = _interopRequireWildcard(_ivprog_elements);
  17870. var _localizedStringsService = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  17871. var _globals = __webpack_require__(/*! ../globals */ "./js/visualUI/globals.js");
  17872. var GlobalsManagement = _interopRequireWildcard(_globals);
  17873. var _variables = __webpack_require__(/*! ../variables */ "./js/visualUI/variables.js");
  17874. var VariablesManagement = _interopRequireWildcard(_variables);
  17875. var _commands = __webpack_require__(/*! ../commands */ "./js/visualUI/commands.js");
  17876. var CommandsManagement = _interopRequireWildcard(_commands);
  17877. var _variable_value_menu = __webpack_require__(/*! ./variable_value_menu */ "./js/visualUI/commands/variable_value_menu.js");
  17878. var VariableValueMenu = _interopRequireWildcard(_variable_value_menu);
  17879. var _contextualized_menu = __webpack_require__(/*! ./contextualized_menu */ "./js/visualUI/commands/contextualized_menu.js");
  17880. var ContextualizedMenu = _interopRequireWildcard(_contextualized_menu);
  17881. 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; } }
  17882. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  17883. function createFloatingCommand() {
  17884. 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>');
  17885. }
  17886. function renderCommand(command, function_obj) {
  17887. var ret = '';
  17888. 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>';
  17889. ret += '</div>';
  17890. var el = (0, _jquery2.default)(ret);
  17891. el.data('command', command);
  17892. addHandlers(command, function_obj, el);
  17893. ContextualizedMenu.renderMenu(command, el.find('.context_menu'), function_obj, el);
  17894. VariableValueMenu.renderMenu(command, command.variable, el.find('.variable_to_switch'), function_obj);
  17895. if (command.cases) {
  17896. for (var i = 0; i < command.cases.length; i++) {
  17897. renderCase(command.cases[i], command, function_obj, el.find('.all_cases_div'));
  17898. }
  17899. }
  17900. return el;
  17901. }
  17902. function renderCase(switchcase, command, function_obj, el) {
  17903. 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>');
  17904. VariableValueMenu.renderMenu(command, switchcase.variable_value_menu, casediv.find('.variable_case'), function_obj);
  17905. casediv.data('switchcase', switchcase);
  17906. casediv.find('.case_commands_block').data('switchcase', switchcase);
  17907. el.append(casediv);
  17908. if (switchcase.commands_block) {
  17909. for (var j = 0; j < switchcase.commands_block.length; j++) {
  17910. CommandsManagement.renderCommand(switchcase.commands_block[j], (0, _jquery2.default)(casediv.find('.case_commands_block')[0]), 3, function_obj);
  17911. }
  17912. }
  17913. casediv.find('.button_remove_command').on('click', function () {
  17914. for (var i = 0; i < command.cases.length; i++) {
  17915. if (switchcase == command.cases[i]) {
  17916. delete command.cases[i];
  17917. command.cases.splice(i, 1);
  17918. casediv.remove();
  17919. break;
  17920. }
  17921. }
  17922. });
  17923. }
  17924. function addHandlers(command, function_obj, switch_dom) {
  17925. switch_dom.find('.button_remove_command').on('click', function () {
  17926. if (CommandsManagement.removeCommand(command, function_obj, switch_dom)) {
  17927. switch_dom.fadeOut();
  17928. }
  17929. });
  17930. }
  17931. /***/ }),
  17932. /***/ "./js/visualUI/commands/variable_value_menu.js":
  17933. /*!*****************************************************!*\
  17934. !*** ./js/visualUI/commands/variable_value_menu.js ***!
  17935. \*****************************************************/
  17936. /*! no static exports found */
  17937. /***/ (function(module, exports, __webpack_require__) {
  17938. "use strict";
  17939. Object.defineProperty(exports, "__esModule", {
  17940. value: true
  17941. });
  17942. exports.VAR_OR_VALUE_TYPES = undefined;
  17943. exports.renderMenu = renderMenu;
  17944. var _jquery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  17945. var _jquery2 = _interopRequireDefault(_jquery);
  17946. var _types = __webpack_require__(/*! ../types */ "./js/visualUI/types.js");
  17947. var _ivprog_elements = __webpack_require__(/*! ../ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  17948. var Models = _interopRequireWildcard(_ivprog_elements);
  17949. var _localizedStringsService = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  17950. var _globals = __webpack_require__(/*! ../globals */ "./js/visualUI/globals.js");
  17951. var GlobalsManagement = _interopRequireWildcard(_globals);
  17952. var _variables = __webpack_require__(/*! ../variables */ "./js/visualUI/variables.js");
  17953. var VariablesManagement = _interopRequireWildcard(_variables);
  17954. var _attribution = __webpack_require__(/*! ./attribution */ "./js/visualUI/commands/attribution.js");
  17955. var AttribuitionsManagement = _interopRequireWildcard(_attribution);
  17956. var _writer = __webpack_require__(/*! ./writer */ "./js/visualUI/commands/writer.js");
  17957. var WritersManagement = _interopRequireWildcard(_writer);
  17958. var _repeatNtimes = __webpack_require__(/*! ./repeatNtimes */ "./js/visualUI/commands/repeatNtimes.js");
  17959. var RepeatNTimesManagement = _interopRequireWildcard(_repeatNtimes);
  17960. 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; } }
  17961. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  17962. 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,
  17963. value_and_function: 6, all: 7 });
  17964. function renderMenu(command, ref_object, dom_object, function_obj) {
  17965. var size_field = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 2;
  17966. var expression_element = arguments[5];
  17967. // Verificar se o objeto atual trata-se de uma chamada de função e conferir se possui a quantidade correta de parâmetros
  17968. // Caso não possua, tem que adicionar as variáveis que servirão de parâmetros:
  17969. if (ref_object.function_called) {
  17970. if (ref_object.function_called.parameters_list) {
  17971. while (ref_object.function_called.parameters_list.length != ref_object.parameters_list.length) {
  17972. if (ref_object.parameters_list.length > ref_object.function_called.parameters_list.length) {
  17973. ref_object.parameters_list.pop();
  17974. } else {
  17975. ref_object.parameters_list.push(new Models.VariableValueMenu(VAR_OR_VALUE_TYPES.all, null, null, null, true));
  17976. }
  17977. }
  17978. }
  17979. }
  17980. var menu_var_or_value = '<div class="ui dropdown menu_var_or_value_dom" data-varmenu="true"><div class="text"></div><i class="dropdown icon"></i><div class="menu">';
  17981. if (ref_object.variable_and_value == VAR_OR_VALUE_TYPES.only_variable) {
  17982. menu_var_or_value = '<div class="ui dropdown menu_var_or_value_dom" data-varmenu="true"><div class="text"></div><i class="dropdown icon"></i><div class="menu menu_only_vars">';
  17983. menu_var_or_value += '</div>';
  17984. }
  17985. 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) {
  17986. menu_var_or_value += '<div class="item" data-option="' + VAR_OR_VALUE_TYPES.only_variable + '"><i class="dropdown icon"></i>' + _localizedStringsService.LocalizedStrings.getUI('variable');
  17987. menu_var_or_value += '<div class="menu menu_only_vars">';
  17988. menu_var_or_value += '</div></div>';
  17989. }
  17990. if (ref_object.variable_and_value == VAR_OR_VALUE_TYPES.only_value) {
  17991. menu_var_or_value = '<input type="text" class="width-dynamic" size="' + size_field + '" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" />';
  17992. }
  17993. 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) {
  17994. menu_var_or_value += '<div class="item" data-option="' + VAR_OR_VALUE_TYPES.only_value + '">' + _localizedStringsService.LocalizedStrings.getUI('text_value') + '</div>';
  17995. }
  17996. if (ref_object.variable_and_value == VAR_OR_VALUE_TYPES.only_function) {
  17997. menu_var_or_value = '<div class="ui dropdown menu_var_or_value_dom" data-varmenu="true"><div class="text"></div><i class="dropdown icon"></i><div class="menu menu_only_functions">';
  17998. menu_var_or_value += '</div>';
  17999. }
  18000. 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) {
  18001. 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');
  18002. menu_var_or_value += '<div class="menu menu_only_functions">';
  18003. menu_var_or_value += '</div></div>';
  18004. if (command.type == Models.COMMAND_TYPES.attribution) {
  18005. menu_var_or_value += '<div class="item"><i class="dropdown icon"></i>' + _localizedStringsService.LocalizedStrings.getUI('text_change');
  18006. menu_var_or_value += '<div class="menu">';
  18007. menu_var_or_value += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.exp_op_exp + '">EXP OP EXP</div>';
  18008. menu_var_or_value += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.op_exp + '">OP EXP</div>';
  18009. menu_var_or_value += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.par_exp_par + '">( EXP )</div>';
  18010. menu_var_or_value += '</div></div>';
  18011. }
  18012. }
  18013. menu_var_or_value += '</div></div>';
  18014. menu_var_or_value = (0, _jquery2.default)(menu_var_or_value);
  18015. dom_object.append(menu_var_or_value);
  18016. ref_object.dom_object = menu_var_or_value;
  18017. addHandlers(command, ref_object, dom_object, menu_var_or_value, function_obj, expression_element);
  18018. addVariablesToMenu(function_obj, menu_var_or_value, ref_object, expression_element);
  18019. addFunctionsToMenu(function_obj, menu_var_or_value, ref_object, expression_element);
  18020. addIVProgFunctionsToMenu(function_obj, menu_var_or_value, ref_object, expression_element);
  18021. if (ref_object.content || ref_object.function_called) {
  18022. if (ref_object.content) {
  18023. // Verificar se a variável ainda existe:
  18024. var variable_fun = isVarInProgram(ref_object.content, function_obj);
  18025. if (variable_fun) {
  18026. ref_object.content = variable_fun;
  18027. renderPreviousContent(function_obj, menu_var_or_value, ref_object, dom_object, command, expression_element);
  18028. } else {
  18029. if (ref_object.content && ref_object.content.type) {
  18030. ref_object.content = null;
  18031. appendSelectText(ref_object, menu_var_or_value);
  18032. } else {
  18033. renderPreviousContent(function_obj, menu_var_or_value, ref_object, dom_object, command, expression_element);
  18034. }
  18035. }
  18036. } else if (ref_object.function_called) {
  18037. // Verificar se a função ainda existe:
  18038. var ret_function = isFunctionInProgram(ref_object.function_called);
  18039. if (ret_function) {
  18040. ref_object.function_called = ret_function;
  18041. renderPreviousContent(function_obj, menu_var_or_value, ref_object, dom_object, command, expression_element);
  18042. } else {
  18043. ref_object.content = null;
  18044. ref_object.row = null;
  18045. ref_object.column = null;
  18046. delete ref_object.function_called;
  18047. delete ref_object.parameters_list;
  18048. appendSelectText(ref_object, menu_var_or_value);
  18049. }
  18050. }
  18051. } else {
  18052. appendSelectText(ref_object, menu_var_or_value);
  18053. }
  18054. }
  18055. function appendSelectText(ref_object, menu_var_or_value) {
  18056. switch (ref_object.variable_and_value) {
  18057. case VAR_OR_VALUE_TYPES.only_variable:
  18058. menu_var_or_value.find('.text').append('<i>' + _localizedStringsService.LocalizedStrings.getUI('var_menu_select_var') + '</i>');
  18059. break;
  18060. case VAR_OR_VALUE_TYPES.all:
  18061. menu_var_or_value.find('.text').append('<i>' + _localizedStringsService.LocalizedStrings.getUI('var_menu_select_all') + '</i>');
  18062. break;
  18063. case VAR_OR_VALUE_TYPES.variable_and_function:
  18064. menu_var_or_value.find('.text').append('<i>' + _localizedStringsService.LocalizedStrings.getUI('var_menu_select_all') + '</i>');
  18065. break;
  18066. case VAR_OR_VALUE_TYPES.only_function:
  18067. menu_var_or_value.find('.text').append('<i>' + _localizedStringsService.LocalizedStrings.getUI('var_menu_select_function') + '</i>');
  18068. break;
  18069. }
  18070. }
  18071. function isFunctionInProgram(function_called_obj) {
  18072. if (function_called_obj.name) {
  18073. if (window.program_obj.functions) {
  18074. for (var i = 0; i < window.program_obj.functions.length; i++) {
  18075. if (window.program_obj.functions[i] == function_called_obj) {
  18076. return window.program_obj.functions[i];
  18077. }
  18078. }
  18079. for (var i = 0; i < window.program_obj.functions.length; i++) {
  18080. if (window.program_obj.functions[i].name == function_called_obj.name) {
  18081. return window.program_obj.functions[i];
  18082. }
  18083. }
  18084. }
  18085. } else if (function_called_obj.identifier) {
  18086. for (var i = 0; i < window.system_functions.length; i++) {
  18087. if (window.system_functions[i].identifier == function_called_obj.identifier) {
  18088. return window.system_functions[i];
  18089. }
  18090. }
  18091. }
  18092. return null;
  18093. }
  18094. function isVarInProgram(var_obj, function_obj) {
  18095. // Verify in locals:
  18096. if (function_obj.variables_list) {
  18097. for (var i = 0; i < function_obj.variables_list.length; i++) {
  18098. if (function_obj.variables_list[i] == var_obj) {
  18099. return function_obj.variables_list[i];
  18100. }
  18101. }
  18102. }
  18103. // Verify in parameters:
  18104. if (function_obj.parameters_list) {
  18105. for (var i = 0; i < function_obj.parameters_list.length; i++) {
  18106. if (function_obj.parameters_list[i] == var_obj) {
  18107. return function_obj.parameters_list[i];
  18108. }
  18109. }
  18110. }
  18111. // Verify in globals:
  18112. if (window.program_obj.globals) {
  18113. for (var i = 0; i < window.program_obj.globals.length; i++) {
  18114. if (window.program_obj.globals[i] == var_obj) {
  18115. return window.program_obj.globals[i];
  18116. }
  18117. }
  18118. }
  18119. // If not found, verify if the reference was lost
  18120. if (var_obj) {
  18121. if (function_obj.variables_list) {
  18122. for (var i = 0; i < function_obj.variables_list.length; i++) {
  18123. if (function_obj.variables_list[i].name == var_obj.name) {
  18124. return function_obj.variables_list[i];
  18125. }
  18126. }
  18127. }
  18128. if (function_obj.parameters_list) {
  18129. for (var i = 0; i < function_obj.parameters_list.length; i++) {
  18130. if (function_obj.parameters_list[i].name == var_obj.name) {
  18131. return function_obj.parameters_list[i];
  18132. }
  18133. }
  18134. }
  18135. if (window.program_obj.globals) {
  18136. for (var i = 0; i < window.program_obj.globals.length; i++) {
  18137. if (window.program_obj.globals[i].name == var_obj.name) {
  18138. return window.program_obj.globals[i];
  18139. }
  18140. }
  18141. }
  18142. }
  18143. return null;
  18144. }
  18145. function renderPreviousContent(function_obj, menu_var_or_value, ref_object, dom_object, command, expression_element) {
  18146. if (ref_object.function_called) {
  18147. menu_var_or_value.remove();
  18148. variableValueMenuCode(command, ref_object, dom_object, function_obj, menu_var_or_value, expression_element);
  18149. } else if (ref_object.content.type) {
  18150. menu_var_or_value.remove();
  18151. variableValueMenuCode(command, ref_object, dom_object, function_obj, menu_var_or_value, expression_element);
  18152. } else {
  18153. menu_var_or_value.remove();
  18154. variableValueMenuCode(command, ref_object, dom_object, function_obj, menu_var_or_value, expression_element);
  18155. }
  18156. }
  18157. function variableValueMenuCode(command, variable_obj, dom_object, function_obj, menu_var_or_value, expression_element) {
  18158. if (variable_obj.content || variable_obj.function_called) {
  18159. // Verificar se a variável ainda existe:
  18160. var var_fun = isVarInProgram(variable_obj.content, function_obj);
  18161. if (var_fun) {
  18162. variable_obj.content = var_fun;
  18163. } else {
  18164. if (variable_obj.content && variable_obj.content.type) {
  18165. variable_obj.content = null;
  18166. appendSelectText(variable_obj, menu_var_or_value);
  18167. }
  18168. }
  18169. } else {
  18170. appendSelectText(variable_obj, menu_var_or_value);
  18171. }
  18172. if (variable_obj.content == null && variable_obj.function_called == null) {
  18173. renderMenu(command, variable_obj, dom_object, function_obj, 2, expression_element);
  18174. return;
  18175. }
  18176. var ret = '';
  18177. if (variable_obj.function_called) {
  18178. if (variable_obj.function_called.parameters_list == null || variable_obj.function_called.length == 0) {
  18179. menu_var_or_value.find('.text').text(' ');
  18180. dom_object.find('.menu_var_or_value_dom').remove();
  18181. var parameters_menu;
  18182. if (variable_obj.function_called.name) {
  18183. parameters_menu = '<div class="parameters_function_called"> ' + variable_obj.function_called.name + ' <span> ( </span>';
  18184. } else {
  18185. 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>';
  18186. }
  18187. parameters_menu += '<span> ) </span></div>';
  18188. parameters_menu = (0, _jquery2.default)(parameters_menu);
  18189. dom_object.append(parameters_menu);
  18190. var context_menu = '<div class="ui dropdown context_menu_clear"><div class="text"></div><i class="dropdown icon"></i><div class="menu">';
  18191. context_menu += '<div class="item" data-clear="true">' + _localizedStringsService.LocalizedStrings.getUI('btn_clear') + '</div>';
  18192. if (command.type == Models.COMMAND_TYPES.attribution) {
  18193. context_menu += '<div class="item"><i class="dropdown icon"></i>' + _localizedStringsService.LocalizedStrings.getUI('text_change');
  18194. context_menu += '<div class="menu">';
  18195. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.exp_op_exp + '">EXP OP EXP</div>';
  18196. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.op_exp + '">OP EXP</div>';
  18197. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.par_exp_par + '">( EXP )</div>';
  18198. context_menu += '</div></div>';
  18199. }
  18200. context_menu += '</div></div>';
  18201. context_menu = (0, _jquery2.default)(context_menu);
  18202. context_menu.insertAfter(dom_object.find('.parameters_function_called'));
  18203. context_menu.dropdown({
  18204. onChange: function onChange(value, text, $selectedItem) {
  18205. console.log('S1');
  18206. if ($selectedItem.data('clear')) {
  18207. console.log('PP1');
  18208. dom_object.text('');
  18209. variable_obj.content = null;
  18210. variable_obj.row = null;
  18211. variable_obj.column = null;
  18212. delete variable_obj.function_called;
  18213. delete variable_obj.parameters_list;
  18214. renderMenu(command, variable_obj, dom_object, function_obj, 2, expression_element);
  18215. }
  18216. if ($selectedItem.data('exp')) {
  18217. AttribuitionsManagement.manageExpressionElements(command, variable_obj, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element);
  18218. }
  18219. },
  18220. selectOnKeydown: false
  18221. });
  18222. } else {
  18223. menu_var_or_value.find('.text').text(' ');
  18224. dom_object.find('.menu_var_or_value_dom').remove();
  18225. var parameters_menu;
  18226. if (variable_obj.function_called.name) {
  18227. parameters_menu = '<div class="parameters_function_called"> ' + variable_obj.function_called.name + ' <span> ( </span>';
  18228. } else {
  18229. 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>';
  18230. }
  18231. for (var j = 0; j < variable_obj.function_called.parameters_list.length; j++) {
  18232. parameters_menu += '<div class="render_style_param parameter_' + j + '"></div>';
  18233. if (j + 1 != variable_obj.function_called.parameters_list.length) {
  18234. parameters_menu += ' , ';
  18235. }
  18236. }
  18237. parameters_menu += '<span> ) </span></div>';
  18238. parameters_menu = (0, _jquery2.default)(parameters_menu);
  18239. dom_object.append(parameters_menu);
  18240. for (var j = 0; j < variable_obj.function_called.parameters_list.length; j++) {
  18241. renderMenu(command, variable_obj.parameters_list[j], parameters_menu.find('.parameter_' + j), function_obj, 2, expression_element);
  18242. }
  18243. var context_menu = '<div class="ui dropdown context_menu_clear"><div class="text"></div><i class="dropdown icon"></i><div class="menu">';
  18244. context_menu += '<div class="item" data-clear="true">' + _localizedStringsService.LocalizedStrings.getUI('btn_clear') + '</div>';
  18245. if (command.type == Models.COMMAND_TYPES.attribution) {
  18246. context_menu += '<div class="item"><i class="dropdown icon"></i>' + _localizedStringsService.LocalizedStrings.getUI('text_change');
  18247. context_menu += '<div class="menu">';
  18248. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.exp_op_exp + '">EXP OP EXP</div>';
  18249. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.op_exp + '">OP EXP</div>';
  18250. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.par_exp_par + '">( EXP )</div>';
  18251. context_menu += '</div></div>';
  18252. }
  18253. context_menu += '</div></div>';
  18254. context_menu = (0, _jquery2.default)(context_menu);
  18255. context_menu.insertAfter(parameters_menu);
  18256. context_menu.dropdown({
  18257. onChange: function onChange(value, text, $selectedItem) {
  18258. console.log('S2');
  18259. if ($selectedItem.data('clear')) {
  18260. console.log('PP2');
  18261. dom_object.text('');
  18262. variable_obj.content = null;
  18263. variable_obj.row = null;
  18264. variable_obj.column = null;
  18265. delete variable_obj.function_called;
  18266. delete variable_obj.parameters_list;
  18267. renderMenu(command, variable_obj, dom_object, function_obj, 2, expression_element);
  18268. }
  18269. if ($selectedItem.data('exp')) {
  18270. AttribuitionsManagement.manageExpressionElements(command, variable_obj, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element);
  18271. }
  18272. },
  18273. selectOnKeydown: false
  18274. });
  18275. }
  18276. } else if (variable_obj.content.type) {
  18277. var variable_render = "";
  18278. if (variable_obj.content.dimensions == 1 && variable_obj.dimensions != 1) {
  18279. variable_render = '<div class="variable_rendered"> <span class="var_name">' + variable_obj.content.name + '</span>';
  18280. variable_render += ' <span>[ </span> <div class="column_container"></div> <span> ]</span>';
  18281. variable_render += '</div>';
  18282. variable_render = (0, _jquery2.default)(variable_render);
  18283. dom_object.append(variable_render);
  18284. var context_menu = '<div class="ui dropdown context_menu_clear"><div class="text"></div><i class="dropdown icon"></i><div class="menu">';
  18285. context_menu += '<div class="item" data-clear="true">' + _localizedStringsService.LocalizedStrings.getUI('btn_clear') + '</div>';
  18286. if (command.type == Models.COMMAND_TYPES.attribution) {
  18287. context_menu += '<div class="item"><i class="dropdown icon"></i>' + _localizedStringsService.LocalizedStrings.getUI('text_change');
  18288. context_menu += '<div class="menu">';
  18289. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.exp_op_exp + '">EXP OP EXP</div>';
  18290. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.op_exp + '">OP EXP</div>';
  18291. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.par_exp_par + '">( EXP )</div>';
  18292. context_menu += '</div></div>';
  18293. }
  18294. context_menu += '</div></div>';
  18295. context_menu = (0, _jquery2.default)(context_menu);
  18296. variable_render.append(context_menu);
  18297. context_menu.dropdown({
  18298. onChange: function onChange(value, text, $selectedItem) {
  18299. console.log('S3');
  18300. if ($selectedItem.data('clear')) {
  18301. console.log('PP3');
  18302. dom_object.text('');
  18303. variable_obj.content = null;
  18304. variable_obj.row = null;
  18305. variable_obj.column = null;
  18306. delete variable_obj.function_called;
  18307. delete variable_obj.parameters_list;
  18308. renderMenu(command, variable_obj, dom_object, function_obj, 2, expression_element);
  18309. }
  18310. if ($selectedItem.data('exp')) {
  18311. AttribuitionsManagement.manageExpressionElements(command, variable_obj, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element);
  18312. }
  18313. },
  18314. selectOnKeydown: false
  18315. });
  18316. if (!variable_obj.column) {
  18317. variable_obj.column = new Models.VariableValueMenu(VAR_OR_VALUE_TYPES.all, null, null, null, true);
  18318. }
  18319. variableValueMenuCode(command, variable_obj.column, (0, _jquery2.default)(variable_render.find('.column_container')), function_obj, menu_var_or_value, expression_element);
  18320. } else if (variable_obj.content.dimensions == 2 && variable_obj.dimensions != 2) {
  18321. variable_render = '<div class="variable_rendered"> <span class="var_name">' + variable_obj.content.name + '</span>';
  18322. variable_render += ' <span>[ </span> <div class="row_container"></div> <span> ]</span>';
  18323. variable_render += ' <span>[ </span> <div class="column_container"></div> <span> ] </span>';
  18324. variable_render += '</div>';
  18325. variable_render = (0, _jquery2.default)(variable_render);
  18326. dom_object.append(variable_render);
  18327. var context_menu = '<div class="ui dropdown context_menu_clear"><div class="text"></div><i class="dropdown icon"></i><div class="menu">';
  18328. context_menu += '<div class="item" data-clear="true">' + _localizedStringsService.LocalizedStrings.getUI('btn_clear') + '</div>';
  18329. if (command.type == Models.COMMAND_TYPES.attribution) {
  18330. context_menu += '<div class="item"><i class="dropdown icon"></i>' + _localizedStringsService.LocalizedStrings.getUI('text_change');
  18331. context_menu += '<div class="menu">';
  18332. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.exp_op_exp + '">EXP OP EXP</div>';
  18333. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.op_exp + '">OP EXP</div>';
  18334. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.par_exp_par + '">( EXP )</div>';
  18335. context_menu += '</div></div>';
  18336. }
  18337. context_menu += '</div></div>';
  18338. context_menu = (0, _jquery2.default)(context_menu);
  18339. variable_render.append(context_menu);
  18340. context_menu.dropdown({
  18341. onChange: function onChange(value, text, $selectedItem) {
  18342. console.log('S4');
  18343. if ($selectedItem.data('clear')) {
  18344. console.log('PP4');
  18345. dom_object.text('');
  18346. variable_obj.content = null;
  18347. variable_obj.row = null;
  18348. variable_obj.column = null;
  18349. delete variable_obj.function_called;
  18350. delete variable_obj.parameters_list;
  18351. renderMenu(command, variable_obj, dom_object, function_obj, 2, expression_element);
  18352. }
  18353. if ($selectedItem.data('exp')) {
  18354. AttribuitionsManagement.manageExpressionElements(command, variable_obj, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element);
  18355. }
  18356. },
  18357. selectOnKeydown: false
  18358. });
  18359. if (!variable_obj.column) {
  18360. variable_obj.column = new Models.VariableValueMenu(VAR_OR_VALUE_TYPES.all, null, null, null, true);
  18361. }
  18362. if (!variable_obj.row) {
  18363. variable_obj.row = new Models.VariableValueMenu(VAR_OR_VALUE_TYPES.all, null, null, null, true);
  18364. }
  18365. variableValueMenuCode(command, variable_obj.row, (0, _jquery2.default)(variable_render.find('.row_container')), function_obj, menu_var_or_value, expression_element);
  18366. variableValueMenuCode(command, variable_obj.column, (0, _jquery2.default)(variable_render.find('.column_container')), function_obj, menu_var_or_value, expression_element);
  18367. } else {
  18368. variable_render = '<div class="variable_rendered"> <span class="var_name">' + variable_obj.content.name + '</span>';
  18369. variable_render += '</div>';
  18370. variable_render = (0, _jquery2.default)(variable_render);
  18371. dom_object.append(variable_render);
  18372. var context_menu = '<div class="ui dropdown context_menu_clear"><div class="text"></div><i class="dropdown icon"></i><div class="menu">';
  18373. context_menu += '<div class="item" data-clear="true">' + _localizedStringsService.LocalizedStrings.getUI('btn_clear') + '</div>';
  18374. if (command.type == Models.COMMAND_TYPES.attribution && !dom_object.hasClass('var_attributed')) {
  18375. console.log('dom_object6');
  18376. console.log(dom_object);
  18377. context_menu += '<div class="item"><i class="dropdown icon"></i>' + _localizedStringsService.LocalizedStrings.getUI('text_change');
  18378. context_menu += '<div class="menu">';
  18379. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.exp_op_exp + '">EXP OP EXP</div>';
  18380. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.op_exp + '">OP EXP</div>';
  18381. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.par_exp_par + '">( EXP )</div>';
  18382. context_menu += '</div></div>';
  18383. }
  18384. context_menu += '</div></div>';
  18385. context_menu = (0, _jquery2.default)(context_menu);
  18386. variable_render.append(context_menu);
  18387. context_menu.dropdown({
  18388. onChange: function onChange(value, text, $selectedItem) {
  18389. console.log('S5');
  18390. if ($selectedItem.data('clear')) {
  18391. console.log('PP5');
  18392. dom_object.text('');
  18393. variable_obj.content = null;
  18394. variable_obj.row = null;
  18395. variable_obj.column = null;
  18396. delete variable_obj.function_called;
  18397. delete variable_obj.parameters_list;
  18398. renderMenu(command, variable_obj, dom_object, function_obj, 2, expression_element);
  18399. }
  18400. if ($selectedItem.data('exp')) {
  18401. AttribuitionsManagement.manageExpressionElements(command, variable_obj, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element);
  18402. }
  18403. },
  18404. selectOnKeydown: false
  18405. });
  18406. }
  18407. } else {
  18408. var variable_render = '<div class="variable_rendered"> <span class="var_name">' + variable_obj.content + '</span>';
  18409. variable_render += '</div>';
  18410. variable_render = (0, _jquery2.default)(variable_render);
  18411. dom_object.append(variable_render);
  18412. var context_menu = '<div class="ui dropdown context_menu_clear"><div class="text"></div><i class="dropdown icon"></i><div class="menu">';
  18413. context_menu += '<div class="item" data-clear="true">' + _localizedStringsService.LocalizedStrings.getUI('btn_clear') + '</div>';
  18414. if (command.type == Models.COMMAND_TYPES.attribution) {
  18415. context_menu += '<div class="item"><i class="dropdown icon"></i>' + _localizedStringsService.LocalizedStrings.getUI('text_change');
  18416. context_menu += '<div class="menu">';
  18417. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.exp_op_exp + '">EXP OP EXP</div>';
  18418. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.op_exp + '">OP EXP</div>';
  18419. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.par_exp_par + '">( EXP )</div>';
  18420. context_menu += '</div></div>';
  18421. }
  18422. context_menu += '</div></div>';
  18423. context_menu = (0, _jquery2.default)(context_menu);
  18424. if (variable_obj.variable_and_value != VAR_OR_VALUE_TYPES.only_value) {
  18425. context_menu.insertAfter(variable_render);
  18426. }
  18427. context_menu.dropdown({
  18428. onChange: function onChange(value, text, $selectedItem) {
  18429. console.log('S6');
  18430. if ($selectedItem.data('clear')) {
  18431. console.log('PP6');
  18432. dom_object.text('');
  18433. variable_obj.content = null;
  18434. variable_obj.row = null;
  18435. variable_obj.column = null;
  18436. delete variable_obj.function_called;
  18437. delete variable_obj.parameters_list;
  18438. dom_object.find('.value_rendered').remove();
  18439. dom_object.find('.context_menu_clear').remove();
  18440. dom_object.find('.width-dynamic-minus').remove();
  18441. renderMenu(command, variable_obj, dom_object, function_obj, 2, expression_element);
  18442. }
  18443. if ($selectedItem.data('exp')) {
  18444. AttribuitionsManagement.manageExpressionElements(command, variable_obj, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element);
  18445. }
  18446. },
  18447. selectOnKeydown: false
  18448. });
  18449. variable_render.on('click', function (e) {
  18450. variable_render.remove();
  18451. variable_render.empty();
  18452. variable_render.remove();
  18453. dom_object.empty();
  18454. dom_object.append('<span class="menu_var_or_value_dom"> </span>');
  18455. openInputToValue(command, variable_obj, dom_object, menu_var_or_value, function_obj, expression_element);
  18456. });
  18457. }
  18458. }
  18459. function addIVProgFunctionsToMenu(function_obj, menu_var_or_value, ref_object, expression_element) {
  18460. var sub_menu = menu_var_or_value.find('.menu_only_functions');
  18461. sub_menu.append('<div class="divider"></div><div class="header">' + _localizedStringsService.LocalizedStrings.getUI('text_header_ivprog_functions') + '</div>');
  18462. 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>');
  18463. 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>');
  18464. 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>');
  18465. 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>');
  18466. // Insert Math functions:
  18467. for (var i = 0; i < window.system_functions.length; i++) {
  18468. var t = (0, _jquery2.default)('<div class="item"></div>');
  18469. t.data('function_reference', window.system_functions[i]);
  18470. t.data('option', VAR_OR_VALUE_TYPES.only_function);
  18471. t.text(_localizedStringsService.LocalizedStrings.getUI(window.system_functions[i].identifier));
  18472. switch (window.system_functions[i].category) {
  18473. case Models.SYSTEM_FUNCTIONS_CATEGORIES.math:
  18474. sub_menu.find('.menu_math_functions').append(t);
  18475. break;
  18476. case Models.SYSTEM_FUNCTIONS_CATEGORIES.text:
  18477. sub_menu.find('.menu_text_functions').append(t);
  18478. break;
  18479. case Models.SYSTEM_FUNCTIONS_CATEGORIES.arrangement:
  18480. sub_menu.find('.menu_arrangement_functions').append(t);
  18481. break;
  18482. case Models.SYSTEM_FUNCTIONS_CATEGORIES.conversion:
  18483. sub_menu.find('.menu_conversion_functions').append(t);
  18484. break;
  18485. }
  18486. }
  18487. }
  18488. function addFunctionsToMenu(function_obj, menu_var_or_value, ref_object, expression_element) {
  18489. var sub_menu = menu_var_or_value.find('.menu_only_functions');
  18490. sub_menu.text('');
  18491. for (var i = 0; i < window.program_obj.functions.length; i++) {
  18492. var temp = (0, _jquery2.default)('<div class="item" data-option="' + VAR_OR_VALUE_TYPES.only_function + '">' + window.program_obj.functions[i].name + ' </div>');
  18493. temp.data('function_reference', window.program_obj.functions[i]);
  18494. sub_menu.append(temp);
  18495. }
  18496. }
  18497. function addVariablesToMenu(function_obj, menu_var_or_value, ref_object, expression_element) {
  18498. var sub_menu = menu_var_or_value.find('.menu_only_vars');
  18499. sub_menu.text('');
  18500. var is_there = false;
  18501. if (window.program_obj.globals) {
  18502. if (ref_object.include_constant) {
  18503. for (var i = 0; i < window.program_obj.globals.length; i++) {
  18504. var temp = (0, _jquery2.default)('<div class="item" data-option="' + VAR_OR_VALUE_TYPES.only_variable + '">' + window.program_obj.globals[i].name + ' </div>');
  18505. temp.data('variable_reference', window.program_obj.globals[i]);
  18506. sub_menu.append(temp);
  18507. is_there = true;
  18508. }
  18509. } else {
  18510. for (var i = 0; i < window.program_obj.globals.length; i++) {
  18511. if (!window.program_obj.globals[i].is_constant) {
  18512. var temp = (0, _jquery2.default)('<div class="item" data-option="' + VAR_OR_VALUE_TYPES.only_variable + '">' + window.program_obj.globals[i].name + ' </div>');
  18513. temp.data('variable_reference', window.program_obj.globals[i]);
  18514. sub_menu.append(temp);
  18515. is_there = true;
  18516. }
  18517. }
  18518. }
  18519. }
  18520. if (function_obj.parameters_list) {
  18521. for (var i = 0; i < function_obj.parameters_list.length; i++) {
  18522. var temp = (0, _jquery2.default)('<div class="item" data-option="' + VAR_OR_VALUE_TYPES.only_variable + '">' + function_obj.parameters_list[i].name + ' </div>');
  18523. temp.data('variable_reference', function_obj.parameters_list[i]);
  18524. sub_menu.append(temp);
  18525. is_there = true;
  18526. }
  18527. }
  18528. if (function_obj.variables_list) {
  18529. for (var i = 0; i < function_obj.variables_list.length; i++) {
  18530. var temp = (0, _jquery2.default)('<div class="item" data-option="' + VAR_OR_VALUE_TYPES.only_variable + '">' + function_obj.variables_list[i].name + ' </div>');
  18531. temp.data('variable_reference', function_obj.variables_list[i]);
  18532. sub_menu.append(temp);
  18533. is_there = true;
  18534. }
  18535. }
  18536. if (!is_there) {
  18537. sub_menu.append((0, _jquery2.default)('<div class="header">' + _localizedStringsService.LocalizedStrings.getUI('text_none_variable') + '</div>'));
  18538. sub_menu.append((0, _jquery2.default)('<div class="item disabled">' + _localizedStringsService.LocalizedStrings.getUI('text_none_variable_instruction') + '</div>'));
  18539. }
  18540. }
  18541. function addHandlers(command, ref_object, dom_object, menu_var_or_value, function_obj, expression_element) {
  18542. if (ref_object.variable_and_value != VAR_OR_VALUE_TYPES.only_value) {
  18543. menu_var_or_value.dropdown({
  18544. onChange: function onChange(value, text, $selectedItem) {
  18545. console.log('S7');
  18546. dom_object.find('.var_name').remove();
  18547. switch ($selectedItem.data('option')) {
  18548. case VAR_OR_VALUE_TYPES.only_function:
  18549. openInputToFunction(command, ref_object, dom_object, menu_var_or_value, function_obj, (0, _jquery2.default)($selectedItem).data('function_reference'), expression_element);
  18550. break;
  18551. case VAR_OR_VALUE_TYPES.only_value:
  18552. openInputToValue(command, ref_object, dom_object, menu_var_or_value, function_obj, expression_element);
  18553. break;
  18554. case VAR_OR_VALUE_TYPES.only_variable:
  18555. openInputToVariable(command, ref_object, dom_object, menu_var_or_value, function_obj, (0, _jquery2.default)($selectedItem).data('variable_reference'), expression_element);
  18556. break;
  18557. }
  18558. if ($selectedItem.data('exp')) {
  18559. AttribuitionsManagement.manageExpressionElements(command, ref_object, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element);
  18560. }
  18561. if (command.type == Models.COMMAND_TYPES.repeatNtimes) {
  18562. RepeatNTimesManagement.manageExpressionElements(command, ref_object, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element);
  18563. }
  18564. },
  18565. selectOnKeydown: false
  18566. });
  18567. }
  18568. dom_object.find('.width-dynamic').on('input', function () {
  18569. var inputWidth = (0, _jquery2.default)(this).textWidth() + 10;
  18570. (0, _jquery2.default)(this).focus();
  18571. var tmpStr = (0, _jquery2.default)(this).val();
  18572. (0, _jquery2.default)(this).val('');
  18573. (0, _jquery2.default)(this).val(tmpStr);
  18574. (0, _jquery2.default)(this).css({
  18575. width: inputWidth
  18576. });
  18577. }).trigger('input');
  18578. if (command.type == Models.COMMAND_TYPES.comment) {
  18579. dom_object.parent().on('click', function (e) {
  18580. dom_object.find('.value_rendered').remove();
  18581. dom_object.find('.value_rendered').empty();
  18582. dom_object.find('.value_rendered').remove();
  18583. dom_object.empty();
  18584. dom_object.append('<span class="menu_var_or_value_dom"> </span>');
  18585. openInputToValue(command, ref_object, dom_object, menu_var_or_value, function_obj, expression_element);
  18586. });
  18587. }
  18588. }
  18589. function openInputToFunction(command, ref_object, dom_object, menu_var_or_value, function_obj, function_selected, expression_element) {
  18590. ref_object.function_called = function_selected;
  18591. ref_object.parameters_list = [];
  18592. if (function_selected.parameters_list != null && function_selected.parameters_list.length > 0) {
  18593. menu_var_or_value.find('.text').text(' ');
  18594. dom_object.find('.menu_var_or_value_dom').remove();
  18595. var parameters_menu;
  18596. if (function_selected.name) {
  18597. parameters_menu = '<div class="parameters_function_called"> ' + function_selected.name + ' <span> ( </span>';
  18598. } else {
  18599. parameters_menu = '<div class="parameters_function_called"> <i>' + _localizedStringsService.LocalizedStrings.getUI(function_selected.category) + '.' + _localizedStringsService.LocalizedStrings.getUI(function_selected.identifier) + '</i> <span> ( </span>';
  18600. }
  18601. for (var j = 0; j < function_selected.parameters_list.length; j++) {
  18602. parameters_menu += '<div class="render_style_param parameter_' + j + '"></div>';
  18603. if (j + 1 != function_selected.parameters_list.length) {
  18604. parameters_menu += ' , ';
  18605. }
  18606. }
  18607. parameters_menu += '<span> ) </span></div>';
  18608. parameters_menu = (0, _jquery2.default)(parameters_menu);
  18609. dom_object.append(parameters_menu);
  18610. for (var j = 0; j < function_selected.parameters_list.length; j++) {
  18611. var temp;
  18612. if (function_selected.parameters_list[j].dimensions > 0) {
  18613. temp = new Models.VariableValueMenu(VAR_OR_VALUE_TYPES.variable_and_function, null, null, null, true, function_selected.parameters_list[j].dimensions);
  18614. } else {
  18615. temp = new Models.VariableValueMenu(VAR_OR_VALUE_TYPES.all, null, null, null, true);
  18616. }
  18617. ref_object.parameters_list.push(temp);
  18618. renderMenu(command, temp, parameters_menu.find('.parameter_' + j), function_obj, 2, expression_element);
  18619. }
  18620. var context_menu = '<div class="ui dropdown context_menu_clear"><div class="text"></div><i class="dropdown icon"></i><div class="menu">';
  18621. context_menu += '<div class="item" data-clear="true">' + _localizedStringsService.LocalizedStrings.getUI('btn_clear') + '</div>';
  18622. if (command.type == Models.COMMAND_TYPES.attribution) {
  18623. context_menu += '<div class="item"><i class="dropdown icon"></i>' + _localizedStringsService.LocalizedStrings.getUI('text_change');
  18624. context_menu += '<div class="menu">';
  18625. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.exp_op_exp + '">EXP OP EXP</div>';
  18626. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.op_exp + '">OP EXP</div>';
  18627. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.par_exp_par + '">( EXP )</div>';
  18628. context_menu += '</div></div>';
  18629. }
  18630. context_menu += '</div></div>';
  18631. context_menu = (0, _jquery2.default)(context_menu);
  18632. context_menu.insertAfter(dom_object.find('.parameters_function_called'));
  18633. context_menu.dropdown({
  18634. onChange: function onChange(value, text, $selectedItem) {
  18635. console.log('S8');
  18636. if ($selectedItem.data('clear')) {
  18637. console.log('PP7');
  18638. dom_object.text('');
  18639. ref_object.content = null;
  18640. ref_object.row = null;
  18641. ref_object.column = null;
  18642. delete ref_object.function_called;
  18643. delete ref_object.parameters_list;
  18644. renderMenu(command, ref_object, dom_object, function_obj, 2, expression_element);
  18645. }
  18646. if ($selectedItem.data('exp')) {
  18647. AttribuitionsManagement.manageExpressionElements(command, ref_object, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element);
  18648. }
  18649. },
  18650. selectOnKeydown: false
  18651. });
  18652. } else {
  18653. menu_var_or_value.find('.text').text(' ');
  18654. dom_object.find('.menu_var_or_value_dom').remove();
  18655. var parameters_menu;
  18656. if (function_selected.name) {
  18657. parameters_menu = '<div class="parameters_function_called"> ' + function_selected.name + ' <span> ( </span>';
  18658. } else {
  18659. parameters_menu = '<div class="parameters_function_called"> <i>' + _localizedStringsService.LocalizedStrings.getUI(function_selected.category) + '.' + _localizedStringsService.LocalizedStrings.getUI(function_selected.identifier) + '</i> <span> ( </span>';
  18660. }
  18661. parameters_menu += '<span> ) </span></div>';
  18662. parameters_menu = (0, _jquery2.default)(parameters_menu);
  18663. dom_object.append(parameters_menu);
  18664. var context_menu = '<div class="ui dropdown context_menu_clear"><div class="text"></div><i class="dropdown icon"></i><div class="menu">';
  18665. context_menu += '<div class="item" data-clear="true">' + _localizedStringsService.LocalizedStrings.getUI('btn_clear') + '</div>';
  18666. if (command.type == Models.COMMAND_TYPES.attribution) {
  18667. context_menu += '<div class="item"><i class="dropdown icon"></i>' + _localizedStringsService.LocalizedStrings.getUI('text_change');
  18668. context_menu += '<div class="menu">';
  18669. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.exp_op_exp + '">EXP OP EXP</div>';
  18670. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.op_exp + '">OP EXP</div>';
  18671. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.par_exp_par + '">( EXP )</div>';
  18672. context_menu += '</div></div>';
  18673. }
  18674. context_menu += '</div></div>';
  18675. context_menu = (0, _jquery2.default)(context_menu);
  18676. context_menu.insertAfter(dom_object.find('.parameters_function_called'));
  18677. context_menu.dropdown({
  18678. onChange: function onChange(value, text, $selectedItem) {
  18679. console.log('S9');
  18680. if ($selectedItem.data('clear')) {
  18681. console.log('PP8');
  18682. dom_object.text('');
  18683. ref_object.content = null;
  18684. ref_object.row = null;
  18685. ref_object.column = null;
  18686. delete ref_object.function_called;
  18687. delete ref_object.parameters_list;
  18688. renderMenu(command, ref_object, dom_object, function_obj, 2, expression_element);
  18689. }
  18690. if ($selectedItem.data('exp')) {
  18691. AttribuitionsManagement.manageExpressionElements(command, ref_object, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element);
  18692. }
  18693. },
  18694. selectOnKeydown: false
  18695. });
  18696. }
  18697. if (command.type == Models.COMMAND_TYPES.attribution) {
  18698. AttribuitionsManagement.renderMenuOperations(command, ref_object, dom_object, menu_var_or_value, function_obj);
  18699. }
  18700. }
  18701. function openInputToVariable(command, ref_object, dom_object, menu_var_or_value, function_obj, variable_selected, expression_element) {
  18702. ref_object.content = variable_selected;
  18703. menu_var_or_value.find('.text').text(' ');
  18704. dom_object.find('.menu_var_or_value_dom').remove();
  18705. var variable_render = '<div class="variable_rendered"> <span class="var_name">' + variable_selected.name + '</span>';
  18706. if (variable_selected.dimensions == 1 && ref_object.dimensions != 1) {
  18707. variable_render += ' <span>[ </span> <div class="column_container"></div> <span> ]</span>';
  18708. }
  18709. if (variable_selected.dimensions == 2 && ref_object.dimensions != 2) {
  18710. variable_render += ' <span>[ </span> <div class="row_container"></div> <span> ]</span> ';
  18711. variable_render += ' <span>[ </span> <div class="column_container"></div> <span> ]</span>';
  18712. }
  18713. variable_render += '</div>';
  18714. variable_render = (0, _jquery2.default)(variable_render);
  18715. dom_object.append(variable_render);
  18716. if (variable_selected.dimensions == 1 && ref_object.dimensions != 1) {
  18717. ref_object.column = new Models.VariableValueMenu(VAR_OR_VALUE_TYPES.all, null, null, null, true);
  18718. renderMenu(command, ref_object.column, variable_render.find('.column_container'), function_obj, 2, expression_element);
  18719. }
  18720. if (variable_selected.dimensions == 2 && ref_object.dimensions != 2) {
  18721. ref_object.row = new Models.VariableValueMenu(VAR_OR_VALUE_TYPES.all, null, null, null, true);
  18722. renderMenu(command, ref_object.row, variable_render.find('.row_container'), function_obj, 2, expression_element);
  18723. ref_object.column = new Models.VariableValueMenu(VAR_OR_VALUE_TYPES.all, null, null, null, true);
  18724. renderMenu(command, ref_object.column, variable_render.find('.column_container'), function_obj, 2, expression_element);
  18725. }
  18726. var context_menu = '<div class="ui dropdown context_menu_clear"><div class="text"></div><i class="dropdown icon"></i><div class="menu">';
  18727. context_menu += '<div class="item" data-clear="true">' + _localizedStringsService.LocalizedStrings.getUI('btn_clear') + '</div>';
  18728. if (command.type == Models.COMMAND_TYPES.attribution && !dom_object.hasClass('var_attributed')) {
  18729. console.log("dom_object 10: ");
  18730. console.log(dom_object);
  18731. context_menu += '<div class="item"><i class="dropdown icon"></i>' + _localizedStringsService.LocalizedStrings.getUI('text_change');
  18732. context_menu += '<div class="menu">';
  18733. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.exp_op_exp + '">EXP OP EXP</div>';
  18734. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.op_exp + '">OP EXP</div>';
  18735. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.par_exp_par + '">( EXP )</div>';
  18736. context_menu += '</div></div>';
  18737. }
  18738. context_menu += '</div></div>';
  18739. context_menu = (0, _jquery2.default)(context_menu);
  18740. context_menu.insertAfter(dom_object.find('.variable_rendered'));
  18741. context_menu.dropdown({
  18742. onChange: function onChange(value, text, $selectedItem) {
  18743. console.log('S10');
  18744. if ($selectedItem.data('clear')) {
  18745. console.log('PP9');
  18746. dom_object.text('');
  18747. ref_object.content = null;
  18748. ref_object.row = null;
  18749. ref_object.column = null;
  18750. delete ref_object.function_called;
  18751. delete ref_object.parameters_list;
  18752. renderMenu(command, ref_object, dom_object, function_obj, 2, expression_element);
  18753. }
  18754. if ($selectedItem.data('exp')) {
  18755. AttribuitionsManagement.manageExpressionElements(command, ref_object, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element);
  18756. }
  18757. if (command.type == Models.COMMAND_TYPES.repeatNtimes) {
  18758. RepeatNTimesManagement.manageClearExpressionElements(command, ref_object, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element);
  18759. }
  18760. },
  18761. selectOnKeydown: false
  18762. });
  18763. if (command.type == Models.COMMAND_TYPES.attribution) {
  18764. AttribuitionsManagement.renderMenuOperations(command, ref_object, dom_object, menu_var_or_value, function_obj, variable_selected);
  18765. }
  18766. }
  18767. function openInputToValue(command, ref_object, dom_object, menu_var_or_value, function_obj, expression_element) {
  18768. if (ref_object.content == null) {
  18769. ref_object.content = "";
  18770. }
  18771. menu_var_or_value.find('.text').text(' ');
  18772. var field = (0, _jquery2.default)('<input type="text" size="2" class="width-dynamic-minus" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" />');
  18773. field.insertBefore(dom_object.find('.menu_var_or_value_dom'));
  18774. var rendered = (0, _jquery2.default)('<div class="value_rendered"></div>');
  18775. rendered.insertBefore(field);
  18776. field.focus();
  18777. field.val(ref_object.content);
  18778. var context_menu = '<div class="ui dropdown context_menu_clear"><div class="text"></div><i class="dropdown icon"></i><div class="menu">';
  18779. context_menu += '<div class="item" data-clear="true">' + _localizedStringsService.LocalizedStrings.getUI('btn_clear') + '</div>';
  18780. if (command.type == Models.COMMAND_TYPES.attribution) {
  18781. context_menu += '<div class="item"><i class="dropdown icon"></i>' + _localizedStringsService.LocalizedStrings.getUI('text_change');
  18782. context_menu += '<div class="menu">';
  18783. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.exp_op_exp + '">EXP OP EXP</div>';
  18784. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.op_exp + '">OP EXP</div>';
  18785. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.par_exp_par + '">( EXP )</div>';
  18786. context_menu += '</div></div>';
  18787. }
  18788. context_menu += '</div></div>';
  18789. context_menu = (0, _jquery2.default)(context_menu);
  18790. dom_object.find('.menu_var_or_value_dom').remove();
  18791. if (ref_object.variable_and_value != VAR_OR_VALUE_TYPES.only_value) {
  18792. context_menu.insertAfter(field);
  18793. }
  18794. context_menu.dropdown({
  18795. onChange: function onChange(value, text, $selectedItem) {
  18796. console.log('S11');
  18797. if ($selectedItem.data('clear')) {
  18798. console.log('PP10');
  18799. dom_object.text('');
  18800. dom_object.find('.value_rendered').remove();
  18801. dom_object.find('.context_menu_clear').remove();
  18802. dom_object.find('.width-dynamic-minus').remove();
  18803. ref_object.content = null;
  18804. ref_object.row = null;
  18805. ref_object.column = null;
  18806. delete ref_object.function_called;
  18807. delete ref_object.parameters_list;
  18808. renderMenu(command, ref_object, dom_object, function_obj, 2, expression_element);
  18809. }
  18810. if ($selectedItem.data('exp')) {
  18811. AttribuitionsManagement.manageExpressionElements(command, ref_object, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element);
  18812. }
  18813. },
  18814. selectOnKeydown: false
  18815. });
  18816. dom_object.find('.width-dynamic-minus').focusout(function () {
  18817. if ((0, _jquery2.default)(this).val().trim()) {
  18818. ref_object.content = (0, _jquery2.default)(this).val().trim();
  18819. }
  18820. rendered.text(ref_object.content);
  18821. (0, _jquery2.default)(this).remove();
  18822. });
  18823. dom_object.find('.width-dynamic-minus').on('keydown', function (e) {
  18824. var code = e.keyCode || e.which;
  18825. if (code == 13) {
  18826. if ((0, _jquery2.default)(this).val().trim()) {
  18827. ref_object.content = (0, _jquery2.default)(this).val().trim();
  18828. }
  18829. rendered.text(ref_object.content);
  18830. (0, _jquery2.default)(this).remove();
  18831. }
  18832. if (code == 27) {
  18833. rendered.text(ref_object.content);
  18834. (0, _jquery2.default)(this).remove();
  18835. }
  18836. });
  18837. if (command.type == Models.COMMAND_TYPES.comment) {
  18838. /*rendered.parent().on('click', function(e) {
  18839. rendered.parent().off();
  18840. console.log("TTT14");
  18841. rendered.remove();
  18842. rendered.empty();
  18843. rendered.remove();
  18844. dom_object.empty();
  18845. dom_object.append('<span class="menu_var_or_value_dom"> </span>');
  18846. openInputToValue(command, ref_object, dom_object, menu_var_or_value, function_obj, expression_element)
  18847. });*/
  18848. }
  18849. rendered.on('click', function (e) {
  18850. console.log("TTT2");
  18851. rendered.remove();
  18852. rendered.empty();
  18853. rendered.remove();
  18854. dom_object.empty();
  18855. dom_object.append('<span class="menu_var_or_value_dom"> </span>');
  18856. openInputToValue(command, ref_object, dom_object, menu_var_or_value, function_obj, expression_element);
  18857. });
  18858. if (command.type == Models.COMMAND_TYPES.attribution) {
  18859. AttribuitionsManagement.renderMenuOperations(command, ref_object, dom_object, menu_var_or_value, function_obj);
  18860. }
  18861. }
  18862. _jquery2.default.fn.textWidth = function (text, font) {
  18863. if (!_jquery2.default.fn.textWidth.fakeEl) _jquery2.default.fn.textWidth.fakeEl = (0, _jquery2.default)('<span>').hide().appendTo(document.body);
  18864. _jquery2.default.fn.textWidth.fakeEl.text(text || this.val() || this.text() || this.attr('placeholder')).css('font', font || this.css('font'));
  18865. return _jquery2.default.fn.textWidth.fakeEl.width();
  18866. };
  18867. /***/ }),
  18868. /***/ "./js/visualUI/commands/whiletrue.js":
  18869. /*!*******************************************!*\
  18870. !*** ./js/visualUI/commands/whiletrue.js ***!
  18871. \*******************************************/
  18872. /*! no static exports found */
  18873. /***/ (function(module, exports, __webpack_require__) {
  18874. "use strict";
  18875. Object.defineProperty(exports, "__esModule", {
  18876. value: true
  18877. });
  18878. exports.createFloatingCommand = createFloatingCommand;
  18879. exports.renderCommand = renderCommand;
  18880. var _jquery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  18881. var _jquery2 = _interopRequireDefault(_jquery);
  18882. var _types = __webpack_require__(/*! ../types */ "./js/visualUI/types.js");
  18883. var _ivprog_elements = __webpack_require__(/*! ../ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  18884. var Models = _interopRequireWildcard(_ivprog_elements);
  18885. var _localizedStringsService = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  18886. var _globals = __webpack_require__(/*! ../globals */ "./js/visualUI/globals.js");
  18887. var GlobalsManagement = _interopRequireWildcard(_globals);
  18888. var _variables = __webpack_require__(/*! ../variables */ "./js/visualUI/variables.js");
  18889. var VariablesManagement = _interopRequireWildcard(_variables);
  18890. var _commands = __webpack_require__(/*! ../commands */ "./js/visualUI/commands.js");
  18891. var CommandsManagement = _interopRequireWildcard(_commands);
  18892. var _conditional_expression = __webpack_require__(/*! ./conditional_expression */ "./js/visualUI/commands/conditional_expression.js");
  18893. var ConditionalExpressionManagement = _interopRequireWildcard(_conditional_expression);
  18894. var _contextualized_menu = __webpack_require__(/*! ./contextualized_menu */ "./js/visualUI/commands/contextualized_menu.js");
  18895. var ContextualizedMenu = _interopRequireWildcard(_contextualized_menu);
  18896. 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; } }
  18897. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  18898. function createFloatingCommand() {
  18899. 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>');
  18900. }
  18901. function renderCommand(command, function_obj) {
  18902. var ret = '';
  18903. 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>';
  18904. ret += '<span class="span_command_spec"> ( </span> <div class="conditional_expression"></div> <span class="span_command_spec"> ) </span>';
  18905. ret += ' </span>';
  18906. ret += '<div class="ui block_commands">';
  18907. ret += '</div>';
  18908. ret += '<span> </span>';
  18909. ret += '</div>';
  18910. var el = (0, _jquery2.default)(ret);
  18911. el.data('command', command);
  18912. el.find('.block_commands').data('command', command);
  18913. addHandlers(command, function_obj, el);
  18914. ContextualizedMenu.renderMenu(command, el.find('.context_menu'), function_obj, el);
  18915. ConditionalExpressionManagement.renderExpression(command, command.expression, function_obj, el.find('.conditional_expression'));
  18916. if (command.commands_block) {
  18917. for (var j = 0; j < command.commands_block.length; j++) {
  18918. CommandsManagement.renderCommand(command.commands_block[j], (0, _jquery2.default)(el.find('.block_commands')[0]), 3, function_obj);
  18919. }
  18920. }
  18921. return el;
  18922. }
  18923. function addHandlers(command, function_obj, whiletrue_dom) {
  18924. whiletrue_dom.find('.button_remove_command').on('click', function () {
  18925. if (CommandsManagement.removeCommand(command, function_obj, whiletrue_dom)) {
  18926. whiletrue_dom.fadeOut();
  18927. }
  18928. });
  18929. }
  18930. /***/ }),
  18931. /***/ "./js/visualUI/commands/writer.js":
  18932. /*!****************************************!*\
  18933. !*** ./js/visualUI/commands/writer.js ***!
  18934. \****************************************/
  18935. /*! no static exports found */
  18936. /***/ (function(module, exports, __webpack_require__) {
  18937. "use strict";
  18938. Object.defineProperty(exports, "__esModule", {
  18939. value: true
  18940. });
  18941. exports.createFloatingCommand = createFloatingCommand;
  18942. exports.renderCommand = renderCommand;
  18943. exports.addContent = addContent;
  18944. var _jquery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  18945. var _jquery2 = _interopRequireDefault(_jquery);
  18946. var _types = __webpack_require__(/*! ../types */ "./js/visualUI/types.js");
  18947. var _ivprog_elements = __webpack_require__(/*! ../ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  18948. var Models = _interopRequireWildcard(_ivprog_elements);
  18949. var _localizedStringsService = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  18950. var _globals = __webpack_require__(/*! ../globals */ "./js/visualUI/globals.js");
  18951. var GlobalsManagement = _interopRequireWildcard(_globals);
  18952. var _variables = __webpack_require__(/*! ../variables */ "./js/visualUI/variables.js");
  18953. var VariablesManagement = _interopRequireWildcard(_variables);
  18954. var _variable_value_menu = __webpack_require__(/*! ./variable_value_menu */ "./js/visualUI/commands/variable_value_menu.js");
  18955. var VariableValueMenu = _interopRequireWildcard(_variable_value_menu);
  18956. var VariableValueMenuManagement = _interopRequireWildcard(_variable_value_menu);
  18957. var _commands = __webpack_require__(/*! ../commands */ "./js/visualUI/commands.js");
  18958. var CommandsManagement = _interopRequireWildcard(_commands);
  18959. __webpack_require__(/*! ../../Sortable.js */ "./js/Sortable.js");
  18960. 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; } }
  18961. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  18962. function createFloatingCommand() {
  18963. 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>');
  18964. }
  18965. function renderCommand(command, function_obj) {
  18966. var ret = '';
  18967. 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>';
  18968. var el = (0, _jquery2.default)(ret);
  18969. el.data('command', command);
  18970. for (var i = 0; i < command.content.length; i++) {
  18971. var new_div_item = (0, _jquery2.default)('<div class="var_value_menu_div"></div>');
  18972. var div_parent_with_handler = (0, _jquery2.default)('<div class="div_parent_handler"></div>');
  18973. div_parent_with_handler.append((0, _jquery2.default)('<i class="ui icon ellipsis vertical inverted handler"></i>'));
  18974. div_parent_with_handler.append(new_div_item);
  18975. div_parent_with_handler.append((0, _jquery2.default)('<i class="white inverted icon times handler"></i>'));
  18976. el.find('.all_elements_write').append(div_parent_with_handler);
  18977. VariableValueMenu.renderMenu(command, command.content[i], new_div_item, function_obj);
  18978. addHandlerIconAdd(el.find('.all_elements_write'), command, function_obj);
  18979. addHandlersManager(command, function_obj, el, div_parent_with_handler, command.content[i]);
  18980. }
  18981. if (command.content.length == 0) {
  18982. addHandlerIconAdd(el.find('.all_elements_write'), command, function_obj);
  18983. }
  18984. addHandlers(command, function_obj, el);
  18985. return el;
  18986. }
  18987. function addHandlersManager(command, function_obj, writer_dom, item_div, content_element) {
  18988. item_div.find('.times').on('click', function () {
  18989. for (var i = 0; i < command.content.length; i++) {
  18990. if (command.content[i] == content_element) {
  18991. delete command.content[i];
  18992. command.content.splice(i, 1);
  18993. item_div.children().off();
  18994. item_div.off();
  18995. item_div.fadeOut();
  18996. if (command.content.length > 0) {
  18997. item_div.next('.icon_add_item_to_writer').fadeOut();
  18998. }
  18999. break;
  19000. }
  19001. }
  19002. });
  19003. }
  19004. function addHandlers(command, function_obj, writer_dom) {
  19005. writer_dom.find('.button_remove_command').on('click', function () {
  19006. if (CommandsManagement.removeCommand(command, function_obj, writer_dom)) {
  19007. writer_dom.fadeOut();
  19008. }
  19009. });
  19010. Sortable.create(writer_dom.find(".all_elements_write")[0], {
  19011. handle: '.ellipsis',
  19012. animation: 100,
  19013. ghostClass: 'ghost',
  19014. group: 'writer_' + Math.floor(Math.random() * 10000000),
  19015. draggable: '.div_parent_handler',
  19016. onEnd: function onEnd(evt) {
  19017. command.content.splice(evt.newIndex, 0, command.content.splice(evt.oldIndex, 1)[0]);
  19018. writer_dom.empty();
  19019. writer_dom.replaceWith(renderCommand(command, function_obj));
  19020. }
  19021. });
  19022. }
  19023. function addHandlerIconAdd(dom_object, command, function_obj) {
  19024. var insert_after = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
  19025. var after_which = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : null;
  19026. var icon_add_item = (0, _jquery2.default)('<i class="ui icon plus square outline icon_add_item_to_writer"></i> ');
  19027. if (!insert_after) {
  19028. dom_object.append(icon_add_item);
  19029. } else {
  19030. icon_add_item.insertAfter(after_which);
  19031. }
  19032. icon_add_item.on('click', function (e) {
  19033. var div_parent_with_handler = (0, _jquery2.default)('<div class="div_parent_handler" style="display:none;"></div>');
  19034. var new_div_item = (0, _jquery2.default)('<div class="var_value_menu_div"></div>');
  19035. div_parent_with_handler.append((0, _jquery2.default)('<i class="ui icon ellipsis vertical inverted handler"></i>'));
  19036. div_parent_with_handler.append(new_div_item);
  19037. div_parent_with_handler.append((0, _jquery2.default)('<i class="white inverted icon times handler"></i>'));
  19038. div_parent_with_handler.insertAfter(icon_add_item);
  19039. var new_related_menu = new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.all, null, null, null, true);
  19040. VariableValueMenu.renderMenu(command, new_related_menu, new_div_item, function_obj);
  19041. addHandlerIconAdd(dom_object, command, function_obj, true, div_parent_with_handler);
  19042. addHandlersManager(command, function_obj, dom_object, div_parent_with_handler, new_related_menu);
  19043. var pos = 1;
  19044. dom_object.find('.icon_add_item_to_writer').each(function () {
  19045. if ((0, _jquery2.default)(this).get(0) === icon_add_item.get(0)) {
  19046. command.content.splice(pos, 0, new_related_menu);
  19047. } else {
  19048. pos++;
  19049. }
  19050. });
  19051. if (command.content.length == 1) {
  19052. icon_add_item.remove();
  19053. }
  19054. div_parent_with_handler.fadeIn();
  19055. });
  19056. }
  19057. function addContent(command, ref_object, dom_object, menu_var_or_value, function_obj, ref_object_content) {
  19058. if (dom_object.hasClass('var_value_menu_div')) {
  19059. var icon_add_item = (0, _jquery2.default)('<i class="ui icon plus square outline icon_add_item_to_writer"></i> ');
  19060. icon_add_item.insertAfter(dom_object);
  19061. icon_add_item.on('click', function (e) {
  19062. var div_parent_with_handler = (0, _jquery2.default)('<div class="div_parent_handler"></div>');
  19063. div_parent_with_handler.append((0, _jquery2.default)('<i class="ui icon ellipsis vertical inverted handler"></i>'));
  19064. div_parent_with_handler.append(new_div_item);
  19065. div_parent_with_handler.append((0, _jquery2.default)('<i class="white inverted icon times handler"></i>'));
  19066. div_parent_with_handler.insertAfter(icon_add_item);
  19067. var new_related_menu = new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.all, null, null, null, true);
  19068. VariableValueMenu.renderMenu(command, new_related_menu, new_div_item, function_obj);
  19069. addHandlersManager(command, function_obj, dom_object, div_parent_with_handler, new_related_menu);
  19070. command.content.push(new_related_menu);
  19071. if (command.content.length == 1) {
  19072. icon_add_item.remove();
  19073. }
  19074. });
  19075. }
  19076. }
  19077. /***/ }),
  19078. /***/ "./js/visualUI/functions.js":
  19079. /*!**********************************!*\
  19080. !*** ./js/visualUI/functions.js ***!
  19081. \**********************************/
  19082. /*! no static exports found */
  19083. /***/ (function(module, exports, __webpack_require__) {
  19084. "use strict";
  19085. Object.defineProperty(exports, "__esModule", {
  19086. value: true
  19087. });
  19088. exports.renderFunction = renderFunction;
  19089. exports.initVisualUI = initVisualUI;
  19090. var _jquery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  19091. var _jquery2 = _interopRequireDefault(_jquery);
  19092. var _types = __webpack_require__(/*! ./types */ "./js/visualUI/types.js");
  19093. var _ivprog_elements = __webpack_require__(/*! ./ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  19094. var Models = _interopRequireWildcard(_ivprog_elements);
  19095. var _localizedStringsService = __webpack_require__(/*! ./../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  19096. var _globals = __webpack_require__(/*! ./globals */ "./js/visualUI/globals.js");
  19097. var GlobalsManagement = _interopRequireWildcard(_globals);
  19098. var _variables = __webpack_require__(/*! ./variables */ "./js/visualUI/variables.js");
  19099. var VariablesManagement = _interopRequireWildcard(_variables);
  19100. var _commands = __webpack_require__(/*! ./commands */ "./js/visualUI/commands.js");
  19101. var CommandsManagement = _interopRequireWildcard(_commands);
  19102. var _code_generator = __webpack_require__(/*! ./code_generator */ "./js/visualUI/code_generator.js");
  19103. var CodeManagement = _interopRequireWildcard(_code_generator);
  19104. var _variable_value_menu = __webpack_require__(/*! ./commands/variable_value_menu */ "./js/visualUI/commands/variable_value_menu.js");
  19105. var VariableValueMenu = _interopRequireWildcard(_variable_value_menu);
  19106. var _domConsole = __webpack_require__(/*! ./../io/domConsole */ "./js/io/domConsole.js");
  19107. var _ivprogParser = __webpack_require__(/*! ./../ast/ivprogParser */ "./js/ast/ivprogParser.js");
  19108. var _ivprogProcessor = __webpack_require__(/*! ./../processor/ivprogProcessor */ "./js/processor/ivprogProcessor.js");
  19109. var _melankeWatchjs = __webpack_require__(/*! melanke-watchjs */ "./node_modules/melanke-watchjs/src/watch.js");
  19110. var _melankeWatchjs2 = _interopRequireDefault(_melankeWatchjs);
  19111. var _semanticAnalyser = __webpack_require__(/*! ../processor/semantic/semanticAnalyser */ "./js/processor/semantic/semanticAnalyser.js");
  19112. var _ivprogAssessment = __webpack_require__(/*! ../assessment/ivprogAssessment */ "./js/assessment/ivprogAssessment.js");
  19113. var _algorithm = __webpack_require__(/*! ./algorithm */ "./js/visualUI/algorithm.js");
  19114. var AlgorithmManagement = _interopRequireWildcard(_algorithm);
  19115. var _utils = __webpack_require__(/*! ./utils */ "./js/visualUI/utils.js");
  19116. var Utils = _interopRequireWildcard(_utils);
  19117. __webpack_require__(/*! ../Sortable.js */ "./js/Sortable.js");
  19118. 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; } }
  19119. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  19120. var counter_new_functions = 0;
  19121. var counter_new_parameters = 0;
  19122. var ivprog_version = '2019_01_13 Build 18_55';
  19123. var studentTemp = null;
  19124. var domConsole = null;
  19125. window.studentGrade = null;
  19126. window.LocalizedStrings = _localizedStringsService.LocalizedStrings;
  19127. var program = new Models.Program();
  19128. window.system_functions = [];
  19129. // Adding math functions:
  19130. 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));
  19131. 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));
  19132. 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));
  19133. 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));
  19134. 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));
  19135. 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));
  19136. 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));
  19137. 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));
  19138. 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));
  19139. 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));
  19140. 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));
  19141. // Adding text functions:
  19142. 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));
  19143. 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));
  19144. 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));
  19145. 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));
  19146. 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));
  19147. // Adding arrangement functions:
  19148. window.system_functions.push(new Models.SystemFunction('$numElements', _types.Types.INTEGER, 0, [new Models.VariableValueMenu(VariableValueMenu.VAR_OR_VALUE_TYPES.variable_and_function, null, null, null, true, 1)], null, Models.SYSTEM_FUNCTIONS_CATEGORIES.arrangement));
  19149. window.system_functions.push(new Models.SystemFunction('$matrixLines', _types.Types.INTEGER, 0, [new Models.VariableValueMenu(VariableValueMenu.VAR_OR_VALUE_TYPES.variable_and_function, null, null, null, true, 2)], null, Models.SYSTEM_FUNCTIONS_CATEGORIES.arrangement));
  19150. window.system_functions.push(new Models.SystemFunction('$matrixColumns', _types.Types.INTEGER, 0, [new Models.VariableValueMenu(VariableValueMenu.VAR_OR_VALUE_TYPES.variable_and_function, null, null, null, true, 2)], null, Models.SYSTEM_FUNCTIONS_CATEGORIES.arrangement));
  19151. // Adding conversion functions:
  19152. 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));
  19153. 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));
  19154. 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));
  19155. 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));
  19156. 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));
  19157. 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));
  19158. 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));
  19159. console.log(' ___ ___ ________ \n / / / / / ____/ \n / / / / / / \n / / / / ______ ___ / /__ \n / / / / / \\ / / / ___/ \n / /______ / / / /\\ \\/ / / / \n / / / / / / \\ / / /____ \n/__________/ /___/ /___/ \\___/ /________/ \n\n Laboratório de Informática na Educação\n http://line.ime.usp.br');
  19160. var mainFunction = new Models.Function(_localizedStringsService.LocalizedStrings.getUI("start"), _types.Types.VOID, 0, [], true, false);
  19161. mainFunction.function_comment = new Models.Comment(_localizedStringsService.LocalizedStrings.getUI('text_comment_main'));
  19162. program.addFunction(mainFunction);
  19163. window.program_obj = program;
  19164. window.generator = CodeManagement.generate;
  19165. window.runCodeAssessment = runCodeAssessment;
  19166. window.renderAlgorithm = AlgorithmManagement.renderAlgorithm;
  19167. window.insertContext = false;
  19168. window.watchW = _melankeWatchjs2.default;
  19169. _melankeWatchjs2.default.watch(window.program_obj.globals, function () {
  19170. if (window.insertContext) {
  19171. setTimeout(function () {
  19172. AlgorithmManagement.renderAlgorithm();
  19173. }, 300);
  19174. window.insertContext = false;
  19175. } else {
  19176. AlgorithmManagement.renderAlgorithm();
  19177. }
  19178. }, 1);
  19179. _melankeWatchjs2.default.watch(window.program_obj.functions, function () {
  19180. if (window.insertContext) {
  19181. setTimeout(function () {
  19182. AlgorithmManagement.renderAlgorithm();
  19183. }, 300);
  19184. window.insertContext = false;
  19185. } else {
  19186. AlgorithmManagement.renderAlgorithm();
  19187. }
  19188. }, 1);
  19189. function addFunctionHandler() {
  19190. 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')));
  19191. program.addFunction(new_function);
  19192. counter_new_functions++;
  19193. window.insertContext = true;
  19194. var newe = renderFunction(new_function);
  19195. newe.css('display', 'none');
  19196. newe.fadeIn();
  19197. }
  19198. function addParameter(function_obj, function_container) {
  19199. var is_from_click = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  19200. if (function_obj.parameters_list == null) {
  19201. function_obj.parameters_list = [];
  19202. }
  19203. var new_parameter = new Models.Variable(_types.Types.INTEGER, _localizedStringsService.LocalizedStrings.getUI("new_parameter") + "_" + counter_new_parameters);
  19204. function_obj.parameters_list.push(new_parameter);
  19205. counter_new_parameters++;
  19206. var newe = renderParameter(function_obj, new_parameter, function_container);
  19207. if (is_from_click) {
  19208. newe.css('display', 'none');
  19209. newe.fadeIn();
  19210. }
  19211. }
  19212. function updateReturnType(function_obj, new_type) {
  19213. var new_dimensions = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
  19214. function_obj.return_type = new_type;
  19215. function_obj.return_dimensions = new_dimensions;
  19216. }
  19217. function removeFunction(function_obj) {
  19218. var index = program.functions.indexOf(function_obj);
  19219. if (index > -1) {
  19220. program.functions.splice(index, 1);
  19221. }
  19222. }
  19223. function minimizeFunction(function_obj) {
  19224. function_obj.is_hidden = !function_obj.is_hidden;
  19225. }
  19226. function addHandlers(function_obj, function_container) {
  19227. function_container.find('.ui.dropdown.function_return').dropdown({
  19228. onChange: function onChange(value, text, $selectedItem) {
  19229. if ($selectedItem.data('dimensions')) {
  19230. updateReturnType(function_obj, _types.Types[$selectedItem.data('type')], $selectedItem.data('dimensions'));
  19231. } else {
  19232. updateReturnType(function_obj, _types.Types[$selectedItem.data('type')]);
  19233. }
  19234. },
  19235. selectOnKeydown: false
  19236. });
  19237. function_container.find(".name_function_updated").on('click', function (e) {
  19238. enableNameFunctionUpdate(function_obj, function_container);
  19239. });
  19240. function_container.find(".add_parameter_button").on('click', function (e) {
  19241. window.insertContext = true;
  19242. addParameter(function_obj, function_container, true);
  19243. });
  19244. function_container.find('.menu_commands').dropdown({
  19245. on: 'hover'
  19246. });
  19247. function_container.find('.menu_commands a').on('click', function (evt) {
  19248. if (function_obj.commands == null || function_obj.commands.length == 0) {
  19249. function_obj.commands = [];
  19250. var new_cmd = CommandsManagement.genericCreateCommand((0, _jquery2.default)(this).data('command'));
  19251. function_obj.commands.push(new_cmd);
  19252. CommandsManagement.renderCommand(new_cmd, function_container.find('.commands_list_div'), 3, function_obj);
  19253. } else {
  19254. CommandsManagement.createFloatingCommand(function_obj, function_container, (0, _jquery2.default)(this).data('command'), evt);
  19255. }
  19256. });
  19257. function_container.find('.add_var_button_function').on('click', function (e) {
  19258. window.insertContext = true;
  19259. VariablesManagement.addVariable(function_obj, function_container, true);
  19260. });
  19261. function_container.find('.remove_function_button').on('click', function (e) {
  19262. removeFunction(function_obj);
  19263. function_container.fadeOut();
  19264. });
  19265. function_container.find('.minimize_function_button').on('click', function (e) {
  19266. minimizeFunction(function_obj);
  19267. if (function_obj.is_hidden) {
  19268. function_container.find(".add_var_button_function").toggle();
  19269. function_container.find(".inline_add_command").toggle();
  19270. function_container.find(".function_area").slideToggle();
  19271. } else {
  19272. function_container.find(".function_area").slideToggle(function () {
  19273. function_container.find(".add_var_button_function").toggle();
  19274. function_container.find(".inline_add_command").toggle();
  19275. });
  19276. }
  19277. });
  19278. }
  19279. // Essa função imprime o tipo de retorno da função e cria o menu do tipo 'select' para alteração
  19280. function renderFunctionReturn(function_obj, function_element) {
  19281. var ret = '<div class="ui dropdown function_return">';
  19282. if (function_obj.return_dimensions > 0) {
  19283. ret += '<div class="text">' + _localizedStringsService.LocalizedStrings.getUI("vector") + ':' + _localizedStringsService.LocalizedStrings.getUI(function_obj.return_type);
  19284. if (function_obj.return_dimensions == 1) {
  19285. ret += ' [ ] ';
  19286. } else {
  19287. ret += ' [ ] [ ] ';
  19288. }
  19289. ret += '</div>';
  19290. } else {
  19291. ret += '<div class="text">' + _localizedStringsService.LocalizedStrings.getUI(function_obj.return_type) + '</div>';
  19292. }
  19293. ret += '<div class="menu">';
  19294. for (var tm in _types.Types) {
  19295. 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>';
  19296. }
  19297. for (var tm in _types.Types) {
  19298. if (tm == _types.Types.VOID.toUpperCase()) {
  19299. continue;
  19300. }
  19301. 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>';
  19302. }
  19303. ret += '</div></div>';
  19304. ret = (0, _jquery2.default)(ret);
  19305. function_element.find('.function_return').append(ret);
  19306. }
  19307. var cont = 0;
  19308. function renderFunction(function_obj) {
  19309. var appender = '<div class="ui secondary segment function_div list-group-item function_cont_' + cont + '">';
  19310. if (function_obj.function_comment) {
  19311. //appender += renderComment(function_obj.function_comment, sequence, true, -1);
  19312. }
  19313. appender += '<span class="glyphicon glyphicon-move move_function" aria-hidden="true"><i class="icon sort alternate vertical"></i></span>';
  19314. 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>';
  19315. appender += '<div class="function_signature_div">' + _localizedStringsService.LocalizedStrings.getUI("function") + ' ';
  19316. if (function_obj.is_main) {
  19317. 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">';
  19318. } else {
  19319. appender += '<div class="ui function_return"></div>';
  19320. 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">';
  19321. }
  19322. appender += '</div> <span class="parethesis_function"> ) </span> </div>' + (function_obj.is_hidden ? ' <div class="function_area" style="display: none;"> ' : ' <div class="function_area"> ');
  19323. 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>';
  19324. appender += '<div class="ui top attached segment variables_list_div"></div>';
  19325. appender += '<div class="ui bottom attached segment commands_list_div commands_cont_' + cont + '">' + '<div class="ui rail" style="width: 35px; margin-left: -36px;"><div class="ui sticky sticky_cont_' + cont + '" style="top: 50px !important;">';
  19326. appender += '<i class="icon plus circle purple"></i><i class="icon circle white back"></i><div class="ui icon button dropdown menu_commands orange" ><i class="icon code"></i> <div class="menu"> ';
  19327. 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>';
  19328. appender += '</div></div>' + '</div>';
  19329. appender += '</div></div>';
  19330. appender = (0, _jquery2.default)(appender);
  19331. (0, _jquery2.default)('.all_functions').append(appender);
  19332. appender.data('fun', function_obj);
  19333. appender.find('.commands_list_div').data('fun', function_obj);
  19334. renderFunctionReturn(function_obj, appender);
  19335. addHandlers(function_obj, appender);
  19336. // Rendering parameters:
  19337. for (var j = 0; j < function_obj.parameters_list.length; j++) {
  19338. renderParameter(function_obj, function_obj.parameters_list[j], appender);
  19339. }
  19340. // Rendering variables:
  19341. for (var j = 0; j < function_obj.variables_list.length; j++) {
  19342. VariablesManagement.renderVariable(appender, function_obj.variables_list[j], function_obj);
  19343. }
  19344. // Rendering commands:
  19345. for (var j = 0; j < function_obj.commands.length; j++) {
  19346. CommandsManagement.renderCommand(function_obj.commands[j], (0, _jquery2.default)(appender.find('.commands_list_div')[0]), 3, function_obj);
  19347. }
  19348. (0, _jquery2.default)('.minimize_function_button').popup({
  19349. content: _localizedStringsService.LocalizedStrings.getUI("tooltip_minimize"),
  19350. delay: {
  19351. show: 750,
  19352. hide: 0
  19353. }
  19354. });
  19355. var function_index = program.functions.indexOf(function_obj);
  19356. Sortable.create(appender.find(".variables_list_div")[0], {
  19357. handle: '.ellipsis',
  19358. animation: 100,
  19359. ghostClass: 'ghost',
  19360. group: 'local_vars_drag_' + function_index,
  19361. onEnd: function onEnd(evt) {
  19362. updateSequenceLocals(evt.oldIndex, evt.newIndex, function_obj);
  19363. }
  19364. });
  19365. addSortableHandler(appender.find(".commands_list_div")[0], function_index);
  19366. if (!function_obj.is_main) {
  19367. Sortable.create(appender.find(".container_parameters_list")[0], {
  19368. handle: '.ellipsis',
  19369. animation: 100,
  19370. ghostClass: 'ghost',
  19371. group: 'parameters_drag_' + program.functions.indexOf(function_obj),
  19372. onEnd: function onEnd(evt) {
  19373. updateSequenceParameters(evt.oldIndex, evt.newIndex, function_obj);
  19374. }
  19375. });
  19376. }
  19377. var teste = '.ui.sticky.sticky_cont_' + cont;
  19378. (0, _jquery2.default)(teste).sticky({
  19379. context: '.ui.bottom.attached.segment.commands_list_div.commands_cont_' + cont,
  19380. scrollContext: '.ivprog_visual_panel',
  19381. observeChanges: true,
  19382. offset: 40,
  19383. onStick: function onStick(evt) {
  19384. (0, _jquery2.default)(teste).css('top', '20px', 'important');
  19385. },
  19386. onBottom: function onBottom(evt) {
  19387. (0, _jquery2.default)(teste).css('top', '20px', 'important');
  19388. },
  19389. onUnstick: function onUnstick(evt) {
  19390. (0, _jquery2.default)(teste).css('top', '20px', 'important');
  19391. },
  19392. onReposition: function onReposition(evt) {
  19393. (0, _jquery2.default)(teste).css('top', '20px', 'important');
  19394. },
  19395. onScroll: function onScroll(evt) {
  19396. (0, _jquery2.default)(teste).css('top', '20px', 'important');
  19397. if (!isVisible((0, _jquery2.default)(teste), (0, _jquery2.default)(teste).parent())) {
  19398. (0, _jquery2.default)(teste).removeClass('fixed');
  19399. }
  19400. },
  19401. onTop: function onTop(evt) {
  19402. (0, _jquery2.default)(teste).css('top', '20px', 'important');
  19403. }
  19404. });
  19405. cont++;
  19406. return appender;
  19407. }
  19408. function isVisible(element, container) {
  19409. var elementTop = (0, _jquery2.default)(element).offset().top,
  19410. elementHeight = (0, _jquery2.default)(element).height(),
  19411. containerTop = (0, _jquery2.default)(container).offset().top,
  19412. containerHeight = (0, _jquery2.default)(container).height() - 30;
  19413. return elementTop - containerTop + elementHeight > 0 && elementTop - containerTop < containerHeight;
  19414. }
  19415. window.evento_drag;
  19416. function updateProgramObjDrag() {
  19417. var nodes = Array.prototype.slice.call((0, _jquery2.default)('.all_functions').children());
  19418. var function_index;
  19419. var start_index;
  19420. var function_obj;
  19421. (0, _jquery2.default)(evento_drag.item).parentsUntil(".all_functions").each(function (index) {
  19422. if ((0, _jquery2.default)(this).hasClass('function_div')) {
  19423. function_index = nodes.indexOf(this);
  19424. start_index = index;
  19425. function_obj = (0, _jquery2.default)(this);
  19426. }
  19427. });
  19428. console.log(function_index);
  19429. var path_target = [];
  19430. (0, _jquery2.default)(evento_drag.item).parentsUntil(".all_functions").each(function (index) {
  19431. if ((0, _jquery2.default)(this).hasClass('command_container')) {
  19432. path_target.push(this);
  19433. }
  19434. });
  19435. if (path_target.length == 0) {
  19436. //console.log('soltou na raiz, na posição: ' + evento_drag.newIndex + ' mas ainda não sei de onde saiu ');
  19437. } else {
  19438. //console.log('soltou dentro de algum bloco, sequência vem logo abaixo (de baixo pra cima): ');
  19439. //console.log(path_target);
  19440. }
  19441. var index_each = [];
  19442. var path_relative = [];
  19443. for (var i = path_target.length - 1; i >= 0; i--) {
  19444. console.log('da vez', (0, _jquery2.default)(path_target[i + 1]));
  19445. if (i == path_target.length - 1) {
  19446. // está na raiz
  19447. var indice_na_raiz = function_obj.find('.command_container').index(path_target[i]);
  19448. console.log('índice na raiz: ', indice_na_raiz);
  19449. } else {
  19450. if ((0, _jquery2.default)(path_target[i + 1]).hasClass('iftrue')) {
  19451. if ((0, _jquery2.default)(path_target[i]).parent().hasClass('commands_if')) {
  19452. path_relative.push('if');
  19453. index_each.push((0, _jquery2.default)(path_target[i]).parent().find('.command_container').index(path_target[i]));
  19454. } else {
  19455. path_relative.push('else');
  19456. index_each.push((0, _jquery2.default)(path_target[i]).parent().find('.command_container').index(path_target[i]));
  19457. }
  19458. } else if ((0, _jquery2.default)(path_target[i + 1]).hasClass('dowhiletrue')) {
  19459. path_relative.push('dowhiletrue');
  19460. index_each.push((0, _jquery2.default)(path_target[i + 1]).find('.command_container').index(path_target[i]));
  19461. } else if ((0, _jquery2.default)(path_target[i + 1]).hasClass('repeatNtimes')) {
  19462. path_relative.push('repeatNtimes');
  19463. index_each.push((0, _jquery2.default)(path_target[i + 1]).find('.command_container').index(path_target[i]));
  19464. } else if ((0, _jquery2.default)(path_target[i + 1]).hasClass('whiletrue')) {
  19465. path_relative.push('whiletrue');
  19466. index_each.push((0, _jquery2.default)(path_target[i + 1]).find('.command_container').index(path_target[i]));
  19467. } else if ((0, _jquery2.default)(path_target[i + 1]).hasClass('switch')) {
  19468. path_relative.push('switch');
  19469. //index_each.push($(path_target[i + 1]).find('.command_container').index(path_target[i]));
  19470. }
  19471. }
  19472. }
  19473. var index_in_block = -1;
  19474. var is_in_else = (0, _jquery2.default)(evento_drag.item).parent().hasClass('commands_else');
  19475. index_in_block = (0, _jquery2.default)(evento_drag.item).parent().find('.command_container').index(evento_drag.item);
  19476. var is_in_case_switch = (0, _jquery2.default)(evento_drag.item).parent().hasClass('case_commands_block');
  19477. var index_case_of_switch = -1;
  19478. if (is_in_case_switch) {
  19479. index_case_of_switch = (0, _jquery2.default)(evento_drag.item).parent().parent().parent().find('.case_div').index((0, _jquery2.default)(evento_drag.item).parent().parent());
  19480. }
  19481. /*console.log('path_relative:');
  19482. console.log(path_relative);
  19483. console.log('index_each:');
  19484. console.log(index_each);
  19485. console.log('index_in_block:');
  19486. console.log(index_in_block);
  19487. console.log('ele está em algum bloco de senão? ');
  19488. console.log(is_in_else);
  19489. console.log('ele está dentro de um case de switch?');
  19490. console.log(is_in_case_switch);
  19491. console.log('qual é o índice do case: ');
  19492. console.log(index_case_of_switch);*/
  19493. // encontrar o elemento na árvore:
  19494. var command_start_point = window.program_obj.functions[function_index].commands[indice_na_raiz];
  19495. var block_to_insert = command_start_point;
  19496. for (var i = 0; i < index_each.length; i++) {
  19497. if (path_relative[i] == "else") {
  19498. block_to_insert = block_to_insert.commands_else[index_each[i]];
  19499. } else if (path_relative[i] == "switch") {} else {
  19500. block_to_insert = block_to_insert.commands_block[index_each[i]];
  19501. }
  19502. }
  19503. //console.log('command_start_point', command_start_point);
  19504. //console.log('block_to_insert', block_to_insert);
  19505. // agora tem que alocar o comando na árvore, mas considerar as quatro situações:
  19506. // (1) se está em um else ou (2) se está em switch ou (3) será um caso padrão ou (4) se será na raiz.
  19507. if (path_target.length == 0) {
  19508. // soltou na raiz:
  19509. window.program_obj.functions[function_index].commands.splice(evento_drag.newIndex, 0, command_in_drag);
  19510. } else if (is_in_else) {
  19511. if (block_to_insert.commands_else) {
  19512. block_to_insert.commands_else.splice(evento_drag.newIndex, 0, command_in_drag);
  19513. } else {
  19514. block_to_insert.commands_else = [];
  19515. block_to_insert.commands_else.push(command_in_drag);
  19516. }
  19517. } else if (is_in_case_switch) {} else {
  19518. // verificar se tem alguma coisa no bloco:
  19519. if (block_to_insert.commands_block) {
  19520. block_to_insert.commands_block.splice(evento_drag.newIndex, 0, command_in_drag);
  19521. } else {
  19522. block_to_insert.commands_block = [];
  19523. block_to_insert.commands_block.push(command_in_drag);
  19524. }
  19525. }
  19526. window.draging = false;
  19527. renderAlgorithm();
  19528. }
  19529. function prepareDragHandler(evt) {
  19530. window.draging = true;
  19531. var nodes = Array.prototype.slice.call((0, _jquery2.default)('.all_functions').children());
  19532. var function_index;
  19533. var function_obj;
  19534. (0, _jquery2.default)(evt.item).parentsUntil(".all_functions").each(function (index) {
  19535. if ((0, _jquery2.default)(this).hasClass('function_div')) {
  19536. function_index = nodes.indexOf(this);
  19537. function_obj = window.program_obj.functions[function_index];
  19538. }
  19539. });
  19540. command_in_drag = (0, _jquery2.default)(evt.item).data("command");
  19541. //console.log('$(evt.item).parent(): ');
  19542. //console.log($(evt.item).parent());
  19543. // descobrir qual das quatro situações:
  19544. if ((0, _jquery2.default)(evt.item).parent().hasClass('commands_list_div')) {
  19545. // está na raiz:
  19546. if (function_obj.commands.indexOf(command_in_drag) > -1) {
  19547. function_obj.commands.splice(function_obj.commands.indexOf(command_in_drag), 1);
  19548. }
  19549. } else if ((0, _jquery2.default)(evt.item).parent().hasClass('commands_else')) {
  19550. // está no else:
  19551. if ((0, _jquery2.default)(evt.item).parent().data('command').commands_else.indexOf(command_in_drag) > -1) {
  19552. (0, _jquery2.default)(evt.item).parent().data('command').commands_else.splice((0, _jquery2.default)(evt.item).parent().data('command').commands_else.indexOf(command_in_drag), 1);
  19553. }
  19554. } else if ((0, _jquery2.default)(evt.item).parent().hasClass('case_commands_block')) {// está em um switch:
  19555. } else {
  19556. // caso padrão:
  19557. if ((0, _jquery2.default)(evt.item).parent().data('command').commands_block.indexOf(command_in_drag) > -1) {
  19558. (0, _jquery2.default)(evt.item).parent().data('command').commands_block.splice((0, _jquery2.default)(evt.item).parent().data('command').commands_block.indexOf(command_in_drag), 1);
  19559. }
  19560. }
  19561. }
  19562. var command_in_drag;
  19563. function addSortableHandler(element, id_function) {
  19564. var n_group = 'commands_drag_' + id_function;
  19565. Sortable.create(element, {
  19566. handle: '.command_drag',
  19567. ghostClass: 'ghost',
  19568. animation: 300,
  19569. group: { name: n_group },
  19570. onEnd: function onEnd(evt) {
  19571. //updateSequenceLocals(evt.oldIndex, evt.newIndex, function_obj);
  19572. var itemEl = evt.item; // dragged HTMLElement
  19573. evt.to; // target list
  19574. evt.from; // previous list
  19575. evt.oldIndex; // element's old index within old parent
  19576. evt.newIndex; // element's new index within new parent
  19577. //console.log('::EVT::');
  19578. //console.log(evt);
  19579. window.evento_drag = evt;
  19580. try {
  19581. updateProgramObjDrag();
  19582. } catch (e) {
  19583. window.draging = false;
  19584. }
  19585. },
  19586. onStart: function onStart(evt) {
  19587. //console.log("START::EVT::");
  19588. //console.log(evt);
  19589. //console.log("\n\ncommand_in_drag");
  19590. try {
  19591. prepareDragHandler(evt);
  19592. } catch (e) {
  19593. window.draging = false;
  19594. }
  19595. }
  19596. });
  19597. element = (0, _jquery2.default)(element);
  19598. element.find(".iftrue").each(function (index) {
  19599. addSortableHandler((0, _jquery2.default)(this).find(".block_commands")[0], id_function);
  19600. addSortableHandler((0, _jquery2.default)(this).find(".block_commands")[1], id_function);
  19601. });
  19602. element.find(".repeatNtimes").each(function (index) {
  19603. addSortableHandler((0, _jquery2.default)(this).find(".block_commands")[0], id_function);
  19604. });
  19605. element.find(".dowhiletrue").each(function (index) {
  19606. addSortableHandler((0, _jquery2.default)(this).find(".block_commands")[0], id_function);
  19607. });
  19608. element.find(".whiletrue").each(function (index) {
  19609. addSortableHandler((0, _jquery2.default)(this).find(".block_commands")[0], id_function);
  19610. });
  19611. element.find(".switch").each(function (index) {
  19612. (0, _jquery2.default)(this).find(".case_div").each(function (index) {
  19613. addSortableHandler((0, _jquery2.default)(this).find(".case_commands_block")[0], id_function);
  19614. });
  19615. });
  19616. }
  19617. function initVisualUI() {
  19618. // MUST USE CONST, LET, OR VAR !!!!!!
  19619. var mainDiv = (0, _jquery2.default)('#visual-main-div');
  19620. // fill mainDiv with functions and globals...
  19621. // renderAlgorithm()...
  19622. (0, _jquery2.default)('.add_function_button').on('click', function () {
  19623. addFunctionHandler();
  19624. });
  19625. (0, _jquery2.default)('.add_global_button').on('click', function () {
  19626. window.insertContext = true;
  19627. GlobalsManagement.addGlobal(program, true);
  19628. });
  19629. (0, _jquery2.default)('.run_button').on('click', function () {
  19630. runCode();
  19631. });
  19632. (0, _jquery2.default)('.visual_coding_button').on('click', function () {
  19633. toggleVisualCoding();
  19634. });
  19635. (0, _jquery2.default)('.textual_coding_button').on('click', function () {
  19636. toggleTextualCoding();
  19637. });
  19638. (0, _jquery2.default)('.assessment').on('click', function () {
  19639. runCodeAssessment();
  19640. is_iassign = true;
  19641. });
  19642. (0, _jquery2.default)('.div_toggle_console').on('click', function () {
  19643. toggleConsole();
  19644. });
  19645. (0, _jquery2.default)('.expand_button').on('click', function () {
  19646. full_screen();
  19647. });
  19648. (0, _jquery2.default)('.main_title h2').prop('title', _localizedStringsService.LocalizedStrings.getUI('text_ivprog_description'));
  19649. }
  19650. var is_iassign = false;
  19651. (0, _jquery2.default)(document).ready(function () {
  19652. var time_show = 750;
  19653. (0, _jquery2.default)('.visual_coding_button').popup({
  19654. content: _localizedStringsService.LocalizedStrings.getUI("tooltip_visual"),
  19655. delay: {
  19656. show: time_show,
  19657. hide: 0
  19658. }
  19659. });
  19660. (0, _jquery2.default)('.textual_coding_button').popup({
  19661. content: _localizedStringsService.LocalizedStrings.getUI("tooltip_textual"),
  19662. delay: {
  19663. show: time_show,
  19664. hide: 0
  19665. }
  19666. });
  19667. (0, _jquery2.default)('.upload_file_button').popup({
  19668. content: _localizedStringsService.LocalizedStrings.getUI("tooltip_upload"),
  19669. delay: {
  19670. show: time_show,
  19671. hide: 0
  19672. }
  19673. });
  19674. (0, _jquery2.default)('.download_file_button').popup({
  19675. content: _localizedStringsService.LocalizedStrings.getUI("tooltip_download"),
  19676. delay: {
  19677. show: time_show,
  19678. hide: 0
  19679. }
  19680. });
  19681. (0, _jquery2.default)('.undo_button').popup({
  19682. content: _localizedStringsService.LocalizedStrings.getUI("tooltip_undo"),
  19683. delay: {
  19684. show: time_show,
  19685. hide: 0
  19686. }
  19687. });
  19688. (0, _jquery2.default)('.redo_button').popup({
  19689. content: _localizedStringsService.LocalizedStrings.getUI("tooltip_redo"),
  19690. delay: {
  19691. show: time_show,
  19692. hide: 0
  19693. }
  19694. });
  19695. (0, _jquery2.default)('.run_button').popup({
  19696. content: _localizedStringsService.LocalizedStrings.getUI("tooltip_run"),
  19697. delay: {
  19698. show: time_show,
  19699. hide: 0
  19700. }
  19701. });
  19702. (0, _jquery2.default)('.assessment_button').popup({
  19703. content: _localizedStringsService.LocalizedStrings.getUI("tooltip_evaluate"),
  19704. delay: {
  19705. show: time_show,
  19706. hide: 0
  19707. }
  19708. });
  19709. (0, _jquery2.default)('.help_button').popup({
  19710. content: _localizedStringsService.LocalizedStrings.getUI("tooltip_help") + ' - ' + _localizedStringsService.LocalizedStrings.getUI("text_ivprog_version") + ' ' + ivprog_version,
  19711. delay: {
  19712. show: time_show,
  19713. hide: 0
  19714. }
  19715. });
  19716. (0, _jquery2.default)('.add_global_button').popup({
  19717. content: _localizedStringsService.LocalizedStrings.getUI("tooltip_add_global"),
  19718. delay: {
  19719. show: time_show,
  19720. hide: 0
  19721. }
  19722. });
  19723. (0, _jquery2.default)('.div_toggle_console').popup({
  19724. content: _localizedStringsService.LocalizedStrings.getUI("tooltip_console"),
  19725. delay: {
  19726. show: time_show,
  19727. hide: 0
  19728. }
  19729. });
  19730. Sortable.create(listWithHandle, {
  19731. handle: '.glyphicon-move',
  19732. animation: 100,
  19733. ghostClass: 'ghost',
  19734. group: 'functions_divs_drag',
  19735. onEnd: function onEnd(evt) {
  19736. updateSequenceFunction(evt.oldIndex, evt.newIndex);
  19737. }
  19738. });
  19739. var listGlobalsHandle = document.getElementById("listGlobalsHandle");
  19740. Sortable.create(listGlobalsHandle, {
  19741. handle: '.ellipsis',
  19742. animation: 100,
  19743. ghostClass: 'ghost',
  19744. group: 'globals_divs_drag',
  19745. onEnd: function onEnd(evt) {
  19746. updateSequenceGlobals(evt.oldIndex, evt.newIndex);
  19747. }
  19748. });
  19749. });
  19750. function updateSequenceParameters(oldIndex, newIndex, function_obj) {
  19751. function_obj.parameters_list.splice(newIndex, 0, function_obj.parameters_list.splice(oldIndex, 1)[0]);
  19752. }
  19753. function updateSequenceLocals(oldIndex, newIndex, function_obj) {
  19754. function_obj.variables_list.splice(newIndex, 0, function_obj.variables_list.splice(oldIndex, 1)[0]);
  19755. }
  19756. function updateSequenceGlobals(oldIndex, newIndex) {
  19757. program_obj.globals.splice(newIndex, 0, program_obj.globals.splice(oldIndex, 1)[0]);
  19758. }
  19759. function updateSequenceFunction(oldIndex, newIndex) {
  19760. program_obj.functions.splice(newIndex, 0, program_obj.functions.splice(oldIndex, 1)[0]);
  19761. }
  19762. function runCodeAssessment() {
  19763. window.studentGrade = null;
  19764. studentTemp = null;
  19765. var strCode = CodeManagement.generate();
  19766. if (strCode == null) {
  19767. return;
  19768. }
  19769. toggleConsole(true);
  19770. if (domConsole == null) domConsole = new _domConsole.DOMConsole("#ivprog-term");
  19771. (0, _jquery2.default)("#ivprog-term").slideDown(500);
  19772. var runner = new _ivprogAssessment.IVProgAssessment(strCode, testCases, domConsole);
  19773. runner.runTest().then(function (grade) {
  19774. if (!is_iassign) {
  19775. parent.getEvaluationCallback(grade);
  19776. } else {
  19777. is_iassign = false;
  19778. }
  19779. }).catch(function (err) {
  19780. return console.log(err);
  19781. });
  19782. }
  19783. function runCode() {
  19784. var strCode = CodeManagement.generate();
  19785. if (strCode == null) {
  19786. return;
  19787. }
  19788. toggleConsole(true);
  19789. if (domConsole == null) domConsole = new _domConsole.DOMConsole("#ivprog-term");
  19790. (0, _jquery2.default)("#ivprog-term").slideDown(500);
  19791. try {
  19792. var parser = _ivprogParser.IVProgParser.createParser(strCode);
  19793. var analyser = new _semanticAnalyser.SemanticAnalyser(parser.parseTree());
  19794. var data = analyser.analyseTree();
  19795. var proc = new _ivprogProcessor.IVProgProcessor(data);
  19796. proc.registerInput(domConsole);
  19797. proc.registerOutput(domConsole);
  19798. (0, _jquery2.default)("#ivprog-term").addClass('ivprog-term-active');
  19799. proc.interpretAST().then(function (_) {
  19800. domConsole.info("Programa executado com sucesso!");
  19801. (0, _jquery2.default)("#ivprog-term").removeClass('ivprog-term-active');
  19802. }).catch(function (err) {
  19803. domConsole.err(err.message);
  19804. (0, _jquery2.default)("#ivprog-term").removeClass('ivprog-term-active');
  19805. });
  19806. } catch (error) {
  19807. domConsole.err(error.message);
  19808. console.log(error);
  19809. }
  19810. }
  19811. function toggleConsole(is_running) {
  19812. if (is_running) {
  19813. (0, _jquery2.default)('.ivprog-term-div').css('display', 'block');
  19814. (0, _jquery2.default)('#ivprog-term').css('min-height', '160px');
  19815. (0, _jquery2.default)('#ivprog-term').css('margin-top', '-170px');
  19816. return;
  19817. }
  19818. if ((0, _jquery2.default)('#ivprog-term').css('min-height') == '160px') {
  19819. // esconder
  19820. (0, _jquery2.default)('.ivprog-term-div').css('display', 'none');
  19821. (0, _jquery2.default)('#ivprog-term').css('min-height', '0');
  19822. (0, _jquery2.default)('#ivprog-term').css('margin-top', '-30px');
  19823. (0, _jquery2.default)('#ivprog-term').css('padding', '5px');
  19824. } else {
  19825. // mostrar
  19826. (0, _jquery2.default)('.ivprog-term-div').css('display', 'block');
  19827. (0, _jquery2.default)('#ivprog-term').css('min-height', '160px');
  19828. (0, _jquery2.default)('#ivprog-term').css('margin-top', '-170px');
  19829. }
  19830. }
  19831. function waitToCloseConsole() {
  19832. domConsole.info("Aperte qualquer tecla para fechar...");
  19833. var p = new Promise(function (resolve, _) {
  19834. domConsole.requestInput(resolve, true);
  19835. });
  19836. p.then(function (_) {
  19837. domConsole.dispose();
  19838. domConsole = null;
  19839. (0, _jquery2.default)("#ivprog-term").hide();
  19840. });
  19841. }
  19842. function toggleTextualCoding() {
  19843. var code = CodeManagement.generate();
  19844. if (code == null) {
  19845. return;
  19846. }
  19847. (0, _jquery2.default)('.ivprog_visual_panel').css('display', 'none');
  19848. (0, _jquery2.default)('.ivprog_textual_panel').css('display', 'block');
  19849. (0, _jquery2.default)('.ivprog_textual_panel').removeClass('loading');
  19850. (0, _jquery2.default)('.ivprog_textual_code').text(code);
  19851. (0, _jquery2.default)('.visual_coding_button').removeClass('active');
  19852. (0, _jquery2.default)('.textual_coding_button').addClass('active');
  19853. }
  19854. function toggleVisualCoding() {
  19855. (0, _jquery2.default)('.ivprog_textual_panel').addClass('loading');
  19856. (0, _jquery2.default)('.ivprog_textual_panel').css('display', 'none');
  19857. (0, _jquery2.default)('.ivprog_visual_panel').css('display', 'block');
  19858. (0, _jquery2.default)('.textual_coding_button').removeClass('active');
  19859. (0, _jquery2.default)('.visual_coding_button').addClass('active');
  19860. }
  19861. function removeParameter(function_obj, parameter_obj, parameter_container) {
  19862. var index = function_obj.parameters_list.indexOf(parameter_obj);
  19863. if (index > -1) {
  19864. window.insertContext = true;
  19865. function_obj.parameters_list.splice(index, 1);
  19866. }
  19867. (0, _jquery2.default)(parameter_container).fadeOut();
  19868. }
  19869. function updateParameterType(parameter_obj, new_type) {
  19870. var new_dimensions = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
  19871. parameter_obj.type = new_type;
  19872. parameter_obj.dimensions = new_dimensions;
  19873. if (new_dimensions > 0) {
  19874. parameter_obj.rows = new_dimensions;
  19875. parameter_obj.columns = 2;
  19876. }
  19877. }
  19878. function renderParameter(function_obj, parameter_obj, function_container) {
  19879. var ret = "";
  19880. ret += '<div class="ui label function_name_parameter pink"><i class="ui icon ellipsis vertical inverted"></i>';
  19881. ret += '<div class="ui dropdown parameter_type">';
  19882. if (parameter_obj.dimensions > 0) {
  19883. ret += '<div class="text">' + _localizedStringsService.LocalizedStrings.getUI('vector') + ':' + _localizedStringsService.LocalizedStrings.getUI(parameter_obj.type);
  19884. if (parameter_obj.dimensions == 1) {
  19885. ret += ' [ ] ';
  19886. } else {
  19887. ret += ' [ ] [ ] ';
  19888. }
  19889. ret += '</div>';
  19890. } else {
  19891. ret += '<div class="text">' + _localizedStringsService.LocalizedStrings.getUI(parameter_obj.type) + '</div>';
  19892. }
  19893. ret += '<div class="menu">';
  19894. for (var tm in _types.Types) {
  19895. if (tm == _types.Types.VOID.toUpperCase()) {
  19896. continue;
  19897. }
  19898. ret += '<div class="item ' + (parameter_obj.type == tm.toLowerCase() ? ' selected ' : '') + '" data-type="' + tm + '" >' + _localizedStringsService.LocalizedStrings.getUI(tm.toLowerCase()) + '</div>';
  19899. }
  19900. for (var tm in _types.Types) {
  19901. if (tm == _types.Types.VOID.toUpperCase()) {
  19902. continue;
  19903. }
  19904. 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>';
  19905. }
  19906. ret += '</div></div>';
  19907. ret += '<div class="parameter_div_edit"><span class="span_name_parameter label_enable_name_parameter">' + parameter_obj.name + '</span></div> ';
  19908. ret += ' <i class="yellow inverted icon times remove_parameter"></i></div>';
  19909. ret = (0, _jquery2.default)(ret);
  19910. function_container.find('.container_parameters_list').append(ret);
  19911. ret.find('.remove_parameter').on('click', function (e) {
  19912. removeParameter(function_obj, parameter_obj, ret);
  19913. });
  19914. ret.find('.ui.dropdown.parameter_type').dropdown({
  19915. onChange: function onChange(value, text, $selectedItem) {
  19916. if ($selectedItem.data('dimensions')) {
  19917. updateParameterType(parameter_obj, _types.Types[$selectedItem.data('type')], $selectedItem.data('dimensions'));
  19918. } else {
  19919. updateParameterType(parameter_obj, _types.Types[$selectedItem.data('type')]);
  19920. }
  19921. },
  19922. selectOnKeydown: false
  19923. });
  19924. ret.find('.label_enable_name_parameter').on('click', function (e) {
  19925. enableNameParameterUpdate(parameter_obj, ret, function_obj);
  19926. });
  19927. return ret;
  19928. }
  19929. function updateParameterName(parameter_var, new_name, parameter_obj_dom, function_obj) {
  19930. if (parameter_var.name == new_name) {
  19931. return;
  19932. }
  19933. if (isValidIdentifier(new_name)) {
  19934. if (variableNameAlreadyExists(new_name, function_obj)) {
  19935. Utils.renderErrorMessage(parameter_obj_dom.find('.parameter_div_edit'), _localizedStringsService.LocalizedStrings.getUI('inform_valid_variable_duplicated'));
  19936. } else {
  19937. parameter_var.name = new_name;
  19938. }
  19939. } else {
  19940. Utils.renderErrorMessage(parameter_obj_dom.find('.parameter_div_edit'), _localizedStringsService.LocalizedStrings.getUI('inform_valid_name'));
  19941. }
  19942. }
  19943. function variableNameAlreadyExists(name_var, function_obj) {
  19944. if (function_obj.parameters_list) {
  19945. for (var i = 0; i < function_obj.parameters_list.length; i++) {
  19946. if (function_obj.parameters_list[i].name == name_var) {
  19947. return true;
  19948. }
  19949. }
  19950. }
  19951. if (function_obj.variables_list) {
  19952. for (var i = 0; i < function_obj.variables_list.length; i++) {
  19953. if (function_obj.variables_list[i].name == name_var) {
  19954. return true;
  19955. }
  19956. }
  19957. }
  19958. return false;
  19959. }
  19960. function updateFunctionName(function_var, new_name, function_obj_dom) {
  19961. if (function_var.name == new_name) {
  19962. return;
  19963. }
  19964. if (isValidIdentifier(new_name)) {
  19965. if (functionNameAlreadyExists(new_name)) {
  19966. Utils.renderErrorMessage(function_obj_dom.find('.function_name_div'), _localizedStringsService.LocalizedStrings.getUI('inform_valid_name_duplicated'));
  19967. } else {
  19968. function_var.name = new_name;
  19969. }
  19970. } else {
  19971. Utils.renderErrorMessage(function_obj_dom.find('.function_name_div'), _localizedStringsService.LocalizedStrings.getUI('inform_valid_name'));
  19972. }
  19973. }
  19974. function functionNameAlreadyExists(function_name) {
  19975. for (var i = 0; i < window.program_obj.functions.length; i++) {
  19976. if (window.program_obj.functions[i].name == function_name) {
  19977. return true;
  19978. }
  19979. }
  19980. return false;
  19981. }
  19982. function isValidIdentifier(identifier_str) {
  19983. return (/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(identifier_str)
  19984. );
  19985. }
  19986. var opened_name_parameter = false;
  19987. var opened_input_parameter = null;
  19988. function enableNameParameterUpdate(parameter_obj, parent_node, function_obj) {
  19989. if (opened_name_parameter) {
  19990. opened_input_parameter.focus();
  19991. return;
  19992. }
  19993. opened_name_parameter = true;
  19994. parent_node = (0, _jquery2.default)(parent_node);
  19995. var input_field;
  19996. parent_node.find('.span_name_parameter').text('');
  19997. 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 + "' />");
  19998. input_field.insertBefore(parent_node.find('.span_name_parameter'));
  19999. input_field.on('input', function () {
  20000. var inputWidth = input_field.textWidth() + 10;
  20001. opened_input_parameter = input_field;
  20002. input_field.focus();
  20003. var tmpStr = input_field.val();
  20004. input_field.val('');
  20005. input_field.val(tmpStr);
  20006. input_field.css({
  20007. width: inputWidth
  20008. });
  20009. }).trigger('input');
  20010. input_field.focusout(function () {
  20011. /// update array:
  20012. if (input_field.val().trim()) {
  20013. updateParameterName(parameter_obj, input_field.val().trim(), parent_node, function_obj);
  20014. parent_node.find('.span_name_parameter').text(parameter_obj.name);
  20015. }
  20016. input_field.off();
  20017. input_field.remove();
  20018. /// update elements:
  20019. opened_name_parameter = false;
  20020. opened_input_parameter = false;
  20021. });
  20022. input_field.on('keydown', function (e) {
  20023. var code = e.keyCode || e.which;
  20024. if (code == 13) {
  20025. if (input_field.val().trim()) {
  20026. updateParameterName(parameter_obj, input_field.val().trim(), parent_node, function_obj);
  20027. parent_node.find('.span_name_parameter').text(parameter_obj.name);
  20028. }
  20029. input_field.off();
  20030. input_field.remove();
  20031. /// update elements:
  20032. opened_name_parameter = false;
  20033. opened_input_parameter = false;
  20034. }
  20035. if (code == 27) {
  20036. parent_node.find('.span_name_parameter').text(parameter_obj.name);
  20037. input_field.off();
  20038. input_field.remove();
  20039. /// update elements:
  20040. opened_name_parameter = false;
  20041. opened_input_parameter = false;
  20042. }
  20043. });
  20044. input_field.select();
  20045. }
  20046. var opened_name_function = false;
  20047. var opened_input = null;
  20048. var previousPadding = null;
  20049. function enableNameFunctionUpdate(function_obj, parent_node) {
  20050. if (opened_name_function) {
  20051. opened_input.focus();
  20052. return;
  20053. }
  20054. parent_node = (0, _jquery2.default)(parent_node);
  20055. parent_node.find('.span_name_function').text('');
  20056. var input_field;
  20057. if (!previousPadding) {
  20058. previousPadding = parent_node.find('.span_name_function').css('padding-left');
  20059. }
  20060. parent_node.find('.span_name_function').css('padding-left', '0');
  20061. parent_node.find('.span_name_function').css('padding-right', '0');
  20062. 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 + "' />");
  20063. input_field.insertBefore(parent_node.find('.span_name_function'));
  20064. input_field.on('input', function () {
  20065. var inputWidth = input_field.textWidth() + 10;
  20066. opened_input = input_field;
  20067. input_field.focus();
  20068. var tmpStr = input_field.val();
  20069. input_field.val('');
  20070. input_field.val(tmpStr);
  20071. input_field.css({
  20072. width: inputWidth
  20073. });
  20074. }).trigger('input');
  20075. input_field.focusout(function () {
  20076. /// update array:
  20077. if (input_field.val().trim()) {
  20078. updateFunctionName(function_obj, input_field.val().trim(), parent_node);
  20079. }
  20080. input_field.off();
  20081. input_field.remove();
  20082. parent_node.find('.span_name_function').css('padding-left', previousPadding);
  20083. parent_node.find('.span_name_function').css('padding-right', previousPadding);
  20084. parent_node.find('.span_name_function').text(function_obj.name);
  20085. /// update elements:
  20086. opened_name_function = false;
  20087. opened_input = false;
  20088. });
  20089. input_field.on('keydown', function (e) {
  20090. var code = e.keyCode || e.which;
  20091. if (code == 13) {
  20092. if (input_field.val().trim()) {
  20093. updateFunctionName(function_obj, input_field.val().trim(), parent_node);
  20094. }
  20095. input_field.off();
  20096. input_field.remove();
  20097. parent_node.find('.span_name_function').css('padding-left', previousPadding);
  20098. parent_node.find('.span_name_function').css('padding-right', previousPadding);
  20099. parent_node.find('.span_name_function').text(function_obj.name);
  20100. /// update elements:
  20101. opened_name_function = false;
  20102. opened_input = false;
  20103. }
  20104. if (code == 27) {
  20105. input_field.off();
  20106. input_field.remove();
  20107. parent_node.find('.span_name_function').css('padding-left', previousPadding);
  20108. parent_node.find('.span_name_function').css('padding-right', previousPadding);
  20109. parent_node.find('.span_name_function').text(function_obj.name);
  20110. /// update elements:
  20111. opened_name_function = false;
  20112. opened_input = false;
  20113. }
  20114. });
  20115. input_field.select();
  20116. }
  20117. /***/ }),
  20118. /***/ "./js/visualUI/globals.js":
  20119. /*!********************************!*\
  20120. !*** ./js/visualUI/globals.js ***!
  20121. \********************************/
  20122. /*! no static exports found */
  20123. /***/ (function(module, exports, __webpack_require__) {
  20124. "use strict";
  20125. Object.defineProperty(exports, "__esModule", {
  20126. value: true
  20127. });
  20128. exports.addGlobal = addGlobal;
  20129. exports.renderGlobal = renderGlobal;
  20130. var _jquery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  20131. var _jquery2 = _interopRequireDefault(_jquery);
  20132. var _types = __webpack_require__(/*! ./types */ "./js/visualUI/types.js");
  20133. var _ivprog_elements = __webpack_require__(/*! ./ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  20134. var Models = _interopRequireWildcard(_ivprog_elements);
  20135. var _localizedStringsService = __webpack_require__(/*! ./../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  20136. var _utils = __webpack_require__(/*! ./utils */ "./js/visualUI/utils.js");
  20137. var Utils = _interopRequireWildcard(_utils);
  20138. __webpack_require__(/*! ../semantic/semantic.min.js */ "./js/semantic/semantic.min.js");
  20139. 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; } }
  20140. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  20141. window.jQuery = _jquery2.default;
  20142. var counter_new_globals = 0;
  20143. function addGlobal(program) {
  20144. var is_from_click = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  20145. var new_global = new Models.Variable(_types.Types.INTEGER, _localizedStringsService.LocalizedStrings.getUI('new_global') + '_' + counter_new_globals, 1);
  20146. counter_new_globals++;
  20147. program.addGlobal(new_global);
  20148. var newe = renderGlobal(new_global);
  20149. if (is_from_click) {
  20150. newe.css('display', 'none');
  20151. newe.fadeIn();
  20152. }
  20153. }
  20154. function toggleConstant(global_var) {
  20155. global_var.is_constant = !global_var.is_constant;
  20156. }
  20157. function updateName(global_var, new_name, global_obj_dom) {
  20158. if (global_var.name == new_name) {
  20159. return;
  20160. }
  20161. if (isValidIdentifier(new_name)) {
  20162. if (globalNameAlreadyExists(new_name)) {
  20163. Utils.renderErrorMessage(global_obj_dom.find('.editing_name_var'), _localizedStringsService.LocalizedStrings.getUI('inform_valid_global_duplicated'));
  20164. } else {
  20165. global_var.name = new_name;
  20166. }
  20167. } else {
  20168. Utils.renderErrorMessage(global_obj_dom.find('.editing_name_var'), _localizedStringsService.LocalizedStrings.getUI('inform_valid_name'));
  20169. }
  20170. }
  20171. function globalNameAlreadyExists(global_name) {
  20172. for (var i = 0; i < window.program_obj.globals.length; i++) {
  20173. if (window.program_obj.globals[i].name == global_name) {
  20174. return true;
  20175. }
  20176. }
  20177. return false;
  20178. }
  20179. function isValidIdentifier(identifier_str) {
  20180. return (/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(identifier_str)
  20181. );
  20182. }
  20183. function updateType(global_var, new_type) {
  20184. var new_dimensions = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
  20185. global_var.type = new_type;
  20186. global_var.dimensions = new_dimensions;
  20187. if (new_dimensions > 0) {
  20188. global_var.rows = new_dimensions;
  20189. global_var.columns = 2;
  20190. }
  20191. updateInitialValues(global_var);
  20192. }
  20193. function removeGlobal(global_var, global_container) {
  20194. var index = window.program_obj.globals.indexOf(global_var);
  20195. if (index > -1) {
  20196. window.insertContext = true;
  20197. window.program_obj.globals.splice(index, 1);
  20198. }
  20199. global_container.children().off();
  20200. global_container.off();
  20201. global_container.fadeOut();
  20202. }
  20203. function updateInitialValues(global_var) {
  20204. if (global_var.type == _types.Types.INTEGER) {
  20205. if (global_var.dimensions == 0) {
  20206. global_var.value = 1;
  20207. }
  20208. if (global_var.dimensions == 1) {
  20209. global_var.value = [1, 1];
  20210. }
  20211. if (global_var.dimensions == 2) {
  20212. global_var.value = [[1, 1], [1, 1]];
  20213. }
  20214. }
  20215. if (global_var.type == _types.Types.REAL) {
  20216. if (global_var.dimensions == 0) {
  20217. global_var.value = 1.0;
  20218. }
  20219. if (global_var.dimensions == 1) {
  20220. global_var.value = [1.0, 1.0];
  20221. }
  20222. if (global_var.dimensions == 2) {
  20223. global_var.value = [[1.0, 1.0], [1.0, 1.0]];
  20224. }
  20225. }
  20226. if (global_var.type == _types.Types.TEXT) {
  20227. if (global_var.dimensions == 0) {
  20228. global_var.value = _localizedStringsService.LocalizedStrings.getUI('text_start');
  20229. }
  20230. if (global_var.dimensions == 1) {
  20231. global_var.value = [_localizedStringsService.LocalizedStrings.getUI('text_start'), _localizedStringsService.LocalizedStrings.getUI('text_start')];
  20232. }
  20233. if (global_var.dimensions == 2) {
  20234. global_var.value = [[_localizedStringsService.LocalizedStrings.getUI('text_start'), _localizedStringsService.LocalizedStrings.getUI('text_start')], [_localizedStringsService.LocalizedStrings.getUI('text_start'), _localizedStringsService.LocalizedStrings.getUI('text_start')]];
  20235. }
  20236. }
  20237. if (global_var.type == _types.Types.BOOLEAN) {
  20238. if (global_var.dimensions == 0) {
  20239. global_var.value = true;
  20240. }
  20241. if (global_var.dimensions == 1) {
  20242. global_var.value = [true, true];
  20243. }
  20244. if (global_var.dimensions == 2) {
  20245. global_var.value = [[true, true], [true, true]];
  20246. }
  20247. }
  20248. }
  20249. function alternateBooleanGlobalValue(global_var, value_container) {
  20250. global_var.value = !global_var.value;
  20251. (0, _jquery2.default)(value_container).find('.span_value_variable').text(_localizedStringsService.LocalizedStrings.getUI(global_var.value));
  20252. }
  20253. function alternateBooleanGlobalVectorValue(global_var, index, value_container) {
  20254. global_var.value[index] = !global_var.value[index];
  20255. (0, _jquery2.default)(value_container).find('.span_value_variable').text(_localizedStringsService.LocalizedStrings.getUI(global_var.value[index]));
  20256. }
  20257. function removeGlobalColumnVector(global_var) {
  20258. if (global_var.columns == 0) {
  20259. return;
  20260. }
  20261. global_var.columns--;
  20262. global_var.value.splice(global_var.value.length - 1, 1);
  20263. }
  20264. function addGlobalColumnVector(global_var) {
  20265. global_var.columns++;
  20266. if (global_var.type == _types.Types.INTEGER) {
  20267. global_var.value.push(1);
  20268. }
  20269. if (global_var.type == _types.Types.REAL) {
  20270. global_var.value.push(1.0);
  20271. }
  20272. if (global_var.type == _types.Types.TEXT) {
  20273. global_var.value.push(_localizedStringsService.LocalizedStrings.getUI('text_start'));
  20274. }
  20275. if (global_var.type == _types.Types.BOOLEAN) {
  20276. global_var.value.push(true);
  20277. }
  20278. }
  20279. function removeColumnGlobalMatrix(global_var) {
  20280. if (global_var.columns == 0) {
  20281. return;
  20282. }
  20283. global_var.columns--;
  20284. for (var i = 0; i < global_var.rows; i++) {
  20285. global_var.value[i].splice(global_var.value[i].length - 1, 1);
  20286. }
  20287. }
  20288. function addColumnGlobalMatrix(global_var) {
  20289. global_var.columns++;
  20290. if (global_var.type == _types.Types.INTEGER) {
  20291. for (var i = 0; i < global_var.rows; i++) {
  20292. global_var.value[i].push(1);
  20293. }
  20294. }
  20295. if (global_var.type == _types.Types.REAL) {
  20296. for (var i = 0; i < global_var.rows; i++) {
  20297. global_var.value[i].push(1.0);
  20298. }
  20299. }
  20300. if (global_var.type == _types.Types.TEXT) {
  20301. for (var i = 0; i < global_var.rows; i++) {
  20302. global_var.value[i].push(_localizedStringsService.LocalizedStrings.getUI('text_start'));
  20303. }
  20304. }
  20305. if (global_var.type == _types.Types.BOOLEAN) {
  20306. for (var i = 0; i < global_var.rows; i++) {
  20307. global_var.value[i].push(true);
  20308. }
  20309. }
  20310. }
  20311. function removeLineGlobalMatrix(global_var) {
  20312. if (global_var.rows == 0) {
  20313. return;
  20314. }
  20315. global_var.rows--;
  20316. global_var.value.splice(global_var.value.length - 1, 1);
  20317. }
  20318. function addLineGlobalMatrix(global_var) {
  20319. global_var.rows++;
  20320. if (global_var.type == _types.Types.INTEGER) {
  20321. var n_l = [];
  20322. for (var i = 0; i < global_var.columns; i++) {
  20323. n_l.push(1);
  20324. }
  20325. global_var.value.push(n_l);
  20326. }
  20327. if (global_var.type == _types.Types.REAL) {
  20328. var n_l = [];
  20329. for (i = 0; i < global_var.columns; i++) {
  20330. n_l.push(1.0);
  20331. }
  20332. global_var.value.push(n_l);
  20333. }
  20334. if (global_var.type == _types.Types.TEXT) {
  20335. var n_l = [];
  20336. for (i = 0; i < global_var.columns; i++) {
  20337. n_l.push(_localizedStringsService.LocalizedStrings.getUI('text_start'));
  20338. }
  20339. global_var.value.push(n_l);
  20340. }
  20341. if (global_var.type == _types.Types.BOOLEAN) {
  20342. var n_l = [];
  20343. for (i = 0; i < global_var.columns; i++) {
  20344. n_l.push(true);
  20345. }
  20346. global_var.value.push(n_l);
  20347. }
  20348. }
  20349. function alternateBooleanGlobalMatrixValue(global_var, row, index, value_container) {
  20350. global_var.value[row][index] = !global_var.value[row][index];
  20351. (0, _jquery2.default)(value_container).find('.span_value_variable').text(_localizedStringsService.LocalizedStrings.getUI(global_var.value[row][index]));
  20352. }
  20353. function renderValues(global_var, global_container) {
  20354. var ret = "";
  20355. var j = 0;
  20356. if (global_var.dimensions == 0) {
  20357. if (global_var.type == _types.Types.REAL) {
  20358. ret += '<div class="created_div_valor_var"><span class="span_value_variable simple_var">' + global_var.value.toFixed(1) + '</span> </div> ';
  20359. } else {
  20360. if (global_var.type == _types.Types.BOOLEAN) {
  20361. ret += '<div class="created_div_valor_var"><span class="span_value_variable boolean_simple_type">' + _localizedStringsService.LocalizedStrings.getUI(global_var.value) + '</span> </div> ';
  20362. } else {
  20363. ret += '<div class="created_div_valor_var"><span class="span_value_variable simple_var">' + global_var.value + '</span> </div> ';
  20364. }
  20365. }
  20366. } else {
  20367. ret += '<table class="tabela_var">';
  20368. if (global_var.dimensions == 1) {
  20369. ret += '<tr>';
  20370. if (global_var.type == _types.Types.REAL) {
  20371. for (var k = 0; k < global_var.columns; k++) {
  20372. ret += '<td><span class="span_value_variable vector_var" data-index="' + k + '">' + global_var.value[k].toFixed(1) + '</span></td>';
  20373. }
  20374. } else {
  20375. for (var k = 0; k < global_var.columns; k++) {
  20376. if (global_var.type == _types.Types.BOOLEAN) {
  20377. ret += '<td><span class="span_value_variable boolean_vector_var" data-index="' + k + '">' + _localizedStringsService.LocalizedStrings.getUI(global_var.value[k]) + '</span></td>';
  20378. } else {
  20379. ret += '<td><span class="span_value_variable vector_var" data-index="' + k + '">' + global_var.value[k] + '</span>' + '</td>';
  20380. }
  20381. }
  20382. }
  20383. ret += '</tr>';
  20384. ret += '</table>';
  20385. 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>';
  20386. }
  20387. if (global_var.dimensions == 2) {
  20388. if (global_var.type == _types.Types.REAL) {
  20389. for (var l = 0; l < global_var.rows; l++) {
  20390. ret += '<tr>';
  20391. for (var k = 0; k < global_var.columns; k++) {
  20392. ret += '<td><span class="span_value_variable matrix_var" data-index="' + k + '" data-row="' + l + '">' + global_var.value[l][k].toFixed(1) + '</span>' + '</td>';
  20393. }
  20394. ret += '</tr>';
  20395. }
  20396. } else {
  20397. for (var l = 0; l < global_var.rows; l++) {
  20398. ret += '<tr>';
  20399. for (var k = 0; k < global_var.columns; k++) {
  20400. if (global_var.type == _types.Types.BOOLEAN) {
  20401. 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>';
  20402. } else {
  20403. ret += '<td><span class="span_value_variable matrix_var" data-index="' + k + '" data-row="' + l + '">' + global_var.value[l][k] + '</span></td>';
  20404. }
  20405. }
  20406. ret += '</tr>';
  20407. }
  20408. }
  20409. if (global_var.rows == 0) {
  20410. ret += '<tr><td></td></tr>';
  20411. }
  20412. 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>';
  20413. ret += '</table>';
  20414. 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>';
  20415. }
  20416. }
  20417. global_container.find(".div_valor_var").html('');
  20418. ret = (0, _jquery2.default)(ret);
  20419. ret.find('.span_value_variable').data('associatedOject', global_var);
  20420. ret.find(".boolean_simple_type").on('click', function (e) {
  20421. alternateBooleanGlobalValue(global_var, this.parentNode);
  20422. });
  20423. ret.find(".simple_var").on('click', function (e) {
  20424. enableGlobalValueUpdate(global_var, this.parentNode);
  20425. });
  20426. ret.find(".boolean_vector_var").on('click', function (e) {
  20427. alternateBooleanGlobalVectorValue(global_var, (0, _jquery2.default)(this).data('index'), this.parentNode);
  20428. });
  20429. ret.find(".vector_var").on('click', function (e) {
  20430. enableGlobalVectorValueUpdate(global_var, (0, _jquery2.default)(this).data('index'), this.parentNode);
  20431. });
  20432. ret.find(".remove_global_vector_column").on('click', function (e) {
  20433. removeGlobalColumnVector(global_var);
  20434. global_container.find(".div_valor_var").html('');
  20435. renderValues(global_var, global_container);
  20436. });
  20437. ret.find(".add_global_vector_column").on('click', function (e) {
  20438. addGlobalColumnVector(global_var);
  20439. global_container.find(".div_valor_var").html('');
  20440. renderValues(global_var, global_container);
  20441. });
  20442. ret.find(".remove_global_matrix_column").on('click', function (e) {
  20443. removeColumnGlobalMatrix(global_var);
  20444. global_container.find(".div_valor_var").html('');
  20445. renderValues(global_var, global_container);
  20446. });
  20447. ret.find(".add_global_matrix_column").on('click', function (e) {
  20448. addColumnGlobalMatrix(global_var);
  20449. global_container.find(".div_valor_var").html('');
  20450. renderValues(global_var, global_container);
  20451. });
  20452. ret.find(".remove_global_matrix_line").on('click', function (e) {
  20453. removeLineGlobalMatrix(global_var);
  20454. global_container.find(".div_valor_var").html('');
  20455. renderValues(global_var, global_container);
  20456. });
  20457. ret.find(".add_global_matrix_line").on('click', function (e) {
  20458. addLineGlobalMatrix(global_var);
  20459. global_container.find(".div_valor_var").html('');
  20460. renderValues(global_var, global_container);
  20461. });
  20462. ret.find(".boolean_matrix_var").on('click', function (e) {
  20463. alternateBooleanGlobalMatrixValue(global_var, (0, _jquery2.default)(this).data('row'), (0, _jquery2.default)(this).data('index'), this.parentNode);
  20464. });
  20465. ret.find(".matrix_var").on('click', function (e) {
  20466. enableGlobalMatrixValueUpdate(global_var, (0, _jquery2.default)(this).data('row'), (0, _jquery2.default)(this).data('index'), this.parentNode);
  20467. });
  20468. global_container.find(".div_valor_var").append(ret);
  20469. updateColumnsAndRowsText(global_container, global_var);
  20470. }
  20471. function addHandlers(global_container) {
  20472. var global_var = global_container.data('associatedOject');
  20473. // Manage constant option:
  20474. global_container.find(".alternate_constant").on('click', function (e) {
  20475. toggleConstant(global_var);
  20476. (0, _jquery2.default)(this).removeClass("on off");
  20477. if (global_var.is_constant) {
  20478. (0, _jquery2.default)(this).addClass("on");
  20479. } else {
  20480. (0, _jquery2.default)(this).addClass("off");
  20481. }
  20482. });
  20483. // Manage global name:
  20484. global_container.find(".enable_edit_name_parameter").on('click', function (e) {
  20485. enableNameUpdate(global_container);
  20486. });
  20487. // Menu to change type:
  20488. global_container.find('.ui.dropdown.global_type').dropdown({
  20489. onChange: function onChange(value, text, $selectedItem) {
  20490. if ($selectedItem.data('dimensions')) {
  20491. updateType(global_var, _types.Types[$selectedItem.data('type')], $selectedItem.data('dimensions'));
  20492. } else {
  20493. updateType(global_var, _types.Types[$selectedItem.data('type')]);
  20494. }
  20495. renderValues(global_var, global_container);
  20496. },
  20497. selectOnKeydown: false
  20498. });
  20499. // Remove global:
  20500. global_container.find(".remove_global").on('click', function (e) {
  20501. removeGlobal(global_var, global_container);
  20502. });
  20503. }
  20504. function updateColumnsAndRowsText(global_container, global_var) {
  20505. var prev = global_container.find('.text').text().split('[');
  20506. if (prev.length == 2) {
  20507. var ff = prev[0] + '[ ' + global_var.columns + ' ] ';
  20508. global_container.find('.text').empty();
  20509. global_container.find('.text').text(ff);
  20510. }
  20511. if (prev.length == 3) {
  20512. var ff = prev[0] + '[ ' + global_var.columns + ' ] [ ' + global_var.rows + ' ] ';
  20513. global_container.find('.text').empty();
  20514. global_container.find('.text').text(ff);
  20515. }
  20516. }
  20517. function renderGlobal(global_var) {
  20518. var element = '<div class="ui label global_container pink"><i class="ui icon ellipsis vertical inverted"></i><div class="global_const">const: ';
  20519. element += '<i class="ui icon toggle ' + (global_var.is_constant ? "on" : "off") + ' alternate_constant"></i></div>';
  20520. element += '<div class="ui dropdown global_type">';
  20521. if (global_var.dimensions > 0) {
  20522. element += '<div class="text">' + _localizedStringsService.LocalizedStrings.getUI('vector') + ':' + _localizedStringsService.LocalizedStrings.getUI(global_var.type);
  20523. for (var i = 0; i < global_var.dimensions; i++) {
  20524. element += ' [ <span class="dimensions_' + i + '"></span> ] ';
  20525. }
  20526. element += '</div>';
  20527. } else {
  20528. element += '<div class="text">' + _localizedStringsService.LocalizedStrings.getUI(global_var.type.toLowerCase()) + '</div>';
  20529. }
  20530. element += '<div class="menu">';
  20531. for (var tm in _types.Types) {
  20532. if (tm == _types.Types.VOID.toUpperCase()) {
  20533. continue;
  20534. }
  20535. element += '<div class="item ' + (global_var.type == tm.toLowerCase() ? ' selected ' : '') + '" data-type="' + tm + '" >' + _localizedStringsService.LocalizedStrings.getUI(tm.toLowerCase()) + '</div>';
  20536. }
  20537. for (var tm in _types.Types) {
  20538. if (tm == _types.Types.VOID.toUpperCase()) {
  20539. continue;
  20540. }
  20541. 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>';
  20542. }
  20543. 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> ';
  20544. element += '<div class="ui div_valor_var">' + global_var.value + '</div>';
  20545. element += ' <i class="yellow inverted icon times remove_global"></i></div>';
  20546. var complete_element = (0, _jquery2.default)(element);
  20547. complete_element.data('associatedOject', global_var);
  20548. (0, _jquery2.default)('.list_globals').append(complete_element);
  20549. addHandlers(complete_element);
  20550. renderValues(global_var, complete_element);
  20551. if (global_var.dimensions == 1) {
  20552. complete_element.find('.dimensions_0').text(global_var.columns);
  20553. }
  20554. if (global_var.dimensions == 2) {
  20555. complete_element.find('.dimensions_0').text(global_var.columns);
  20556. complete_element.find('.dimensions_1').text(global_var.rows);
  20557. }
  20558. return complete_element;
  20559. }
  20560. var opened_name_value_matrix_global_v = false;
  20561. var opened_input_value_matrix_global_v = null;
  20562. function enableGlobalMatrixValueUpdate(global_var, row, index, parent_node) {
  20563. if (opened_name_value_matrix_global_v) {
  20564. opened_input_value_matrix_global_v.focus();
  20565. return;
  20566. }
  20567. parent_node = (0, _jquery2.default)(parent_node);
  20568. opened_name_value_matrix_global_v = true;
  20569. parent_node.find('.span_value_variable').text('');
  20570. var input_field;
  20571. if (global_var.type == _types.Types.REAL) {
  20572. 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) + "' />");
  20573. input_field.insertBefore(parent_node.find('.span_value_variable'));
  20574. } else {
  20575. 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] + "' />");
  20576. input_field.insertBefore(parent_node.find('.span_value_variable'));
  20577. }
  20578. input_field.on('input', function () {
  20579. var inputWidth = input_field.textWidth() + 10;
  20580. opened_input_value_matrix_global_v = input_field;
  20581. input_field.focus();
  20582. var tmpStr = input_field.val();
  20583. input_field.val('');
  20584. input_field.val(tmpStr);
  20585. input_field.css({
  20586. width: inputWidth
  20587. });
  20588. }).trigger('input');
  20589. input_field.focusout(function () {
  20590. /// update array:
  20591. if (input_field.val().trim()) {
  20592. if (global_var.type == _types.Types.REAL) {
  20593. global_var.value[row][index] = parseFloat(input_field.val().trim());
  20594. parent_node.find('.span_value_variable').text(global_var.value[row][index].toFixed(1));
  20595. } else {
  20596. if (global_var.type == _types.Types.INTEGER) {
  20597. global_var.value[row][index] = parseInt(input_field.val().trim());
  20598. } else {
  20599. global_var.value[row][index] = input_field.val().trim();
  20600. }
  20601. parent_node.find('.span_value_variable').text(global_var.value[row][index]);
  20602. }
  20603. } else {
  20604. if (global_var.type == _types.Types.REAL) {
  20605. parent_node.find('.span_value_variable').text(global_var.value[row][index].toFixed(1));
  20606. } else {
  20607. parent_node.find('.span_value_variable').text(global_var.value[row][index]);
  20608. }
  20609. }
  20610. if (global_var.type == _types.Types.TEXT) {
  20611. global_var.value[row][index] = input_field.val();
  20612. parent_node.find('.span_value_variable').text(global_var.value[row][index]);
  20613. }
  20614. input_field.off();
  20615. input_field.remove();
  20616. /// update elements:
  20617. opened_name_value_matrix_global_v = false;
  20618. opened_input_value_matrix_global_v = false;
  20619. });
  20620. input_field.on('keydown', function (e) {
  20621. var code = e.keyCode || e.which;
  20622. if (code == 13) {
  20623. if (input_field.val().trim()) {
  20624. if (global_var.type == _types.Types.REAL) {
  20625. global_var.value[row][index] = parseFloat(input_field.val().trim());
  20626. parent_node.find('.span_value_variable').text(global_var.value[row][index].toFixed(1));
  20627. } else {
  20628. if (global_var.type == _types.Types.INTEGER) {
  20629. global_var.value[row][index] = parseInt(input_field.val().trim());
  20630. } else {
  20631. global_var.value[row][index] = input_field.val().trim();
  20632. }
  20633. parent_node.find('.span_value_variable').text(global_var.value[row][index]);
  20634. }
  20635. } else {
  20636. if (global_var.type == _types.Types.REAL) {
  20637. parent_node.find('.span_value_variable').text(global_var.value[row][index].toFixed(1));
  20638. } else {
  20639. parent_node.find('.span_value_variable').text(global_var.value[row][index]);
  20640. }
  20641. }
  20642. if (global_var.type == _types.Types.TEXT) {
  20643. global_var.value[row][index] = input_field.val();
  20644. parent_node.find('.span_value_variable').text(global_var.value[row][index]);
  20645. }
  20646. input_field.off();
  20647. input_field.remove();
  20648. /// update elements:
  20649. opened_name_value_matrix_global_v = false;
  20650. opened_input_value_matrix_global_v = false;
  20651. }
  20652. if (code == 27) {
  20653. if (global_var.type == _types.Types.REAL) {
  20654. parent_node.find('.span_value_variable').text(global_var.value[row][index].toFixed(1));
  20655. } else {
  20656. parent_node.find('.span_value_variable').text(global_var.value[row][index]);
  20657. }
  20658. input_field.off();
  20659. input_field.remove();
  20660. /// update elements:
  20661. opened_name_value_matrix_global_v = false;
  20662. opened_input_value_matrix_global_v = false;
  20663. }
  20664. });
  20665. input_field.select();
  20666. }
  20667. var opened_name_value_global_var = false;
  20668. var opened_input_value_global_ar = null;
  20669. function enableGlobalValueUpdate(global_var, parent_node) {
  20670. if (opened_name_value_global_var) {
  20671. opened_input_value_global_ar.focus();
  20672. return;
  20673. }
  20674. parent_node = (0, _jquery2.default)(parent_node);
  20675. opened_name_value_global_var = true;
  20676. parent_node.find('.span_value_variable').text('');
  20677. var input_field;
  20678. if (global_var.type == _types.Types.REAL) {
  20679. 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) + "' />");
  20680. input_field.insertBefore(parent_node.find('.span_value_variable'));
  20681. } else {
  20682. 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 + "' />");
  20683. input_field.insertBefore(parent_node.find('.span_value_variable'));
  20684. }
  20685. input_field.on('input', function () {
  20686. var inputWidth = input_field.textWidth() + 10;
  20687. opened_input_value_global_ar = input_field;
  20688. input_field.focus();
  20689. var tmpStr = input_field.val();
  20690. input_field.val('');
  20691. input_field.val(tmpStr);
  20692. input_field.css({
  20693. width: inputWidth
  20694. });
  20695. }).trigger('input');
  20696. input_field.focusout(function () {
  20697. /// update array:
  20698. if (input_field.val().trim()) {
  20699. if (global_var.type == _types.Types.REAL) {
  20700. global_var.value = parseFloat(input_field.val().trim());
  20701. parent_node.find('.span_value_variable').text(global_var.value.toFixed(1));
  20702. } else {
  20703. if (global_var.type == _types.Types.INTEGER) {
  20704. global_var.value = parseInt(input_field.val().trim());
  20705. } else {
  20706. global_var.value = input_field.val().trim();
  20707. }
  20708. parent_node.find('.span_value_variable').text(global_var.value);
  20709. }
  20710. } else {
  20711. if (global_var.type == _types.Types.REAL) {
  20712. parent_node.find('.span_value_variable').text(global_var.value.toFixed(1));
  20713. } else {
  20714. parent_node.find('.span_value_variable').text(global_var.value);
  20715. }
  20716. }
  20717. if (global_var.type == _types.Types.TEXT) {
  20718. global_var.value = input_field.val();
  20719. parent_node.find('.span_value_variable').text(global_var.value);
  20720. }
  20721. input_field.off();
  20722. input_field.remove();
  20723. /// update elements:
  20724. opened_name_value_global_var = false;
  20725. opened_input_value_global_ar = false;
  20726. });
  20727. input_field.on('keydown', function (e) {
  20728. var code = e.keyCode || e.which;
  20729. if (code == 13) {
  20730. if (input_field.val().trim()) {
  20731. if (global_var.type == _types.Types.REAL) {
  20732. global_var.value = parseFloat(input_field.val().trim());
  20733. parent_node.find('.span_value_variable').text(global_var.value.toFixed(1));
  20734. } else {
  20735. if (global_var.type == _types.Types.INTEGER) {
  20736. global_var.value = parseInt(input_field.val().trim());
  20737. } else {
  20738. global_var.value = input_field.val().trim();
  20739. }
  20740. parent_node.find('.span_value_variable').text(global_var.value);
  20741. }
  20742. } else {
  20743. if (global_var.type == _types.Types.REAL) {
  20744. parent_node.find('.span_value_variable').text(global_var.value.toFixed(1));
  20745. } else {
  20746. parent_node.find('.span_value_variable').text(global_var.value);
  20747. }
  20748. }
  20749. if (global_var.type == _types.Types.TEXT) {
  20750. global_var.value = input_field.val();
  20751. parent_node.find('.span_value_variable').text(global_var.value);
  20752. }
  20753. input_field.off();
  20754. input_field.remove();
  20755. /// update elements:
  20756. opened_name_value_global_var = false;
  20757. opened_input_value_global_ar = false;
  20758. }
  20759. if (code == 27) {
  20760. if (global_var.type == _types.Types.REAL) {
  20761. parent_node.find('.span_value_variable').text(global_var.value.toFixed(1));
  20762. } else {
  20763. parent_node.find('.span_value_variable').text(global_var.value);
  20764. }
  20765. input_field.off();
  20766. input_field.remove();
  20767. /// update elements:
  20768. opened_name_value_global_var = false;
  20769. opened_input_value_global_ar = false;
  20770. }
  20771. });
  20772. input_field.select();
  20773. }
  20774. var opened_name_global = false;
  20775. var opened_input_global = null;
  20776. function enableNameUpdate(global_container) {
  20777. var global_var = global_container.data('associatedOject');
  20778. if (opened_name_global) {
  20779. opened_input_global.focus();
  20780. return;
  20781. }
  20782. opened_name_global = true;
  20783. global_container.find('.span_name_variable').text('');
  20784. 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 + "' />");
  20785. input_name.insertBefore(global_container.find('.span_name_variable'));
  20786. input_name.on('input', function () {
  20787. var inputWidth = input_name.textWidth() + 10;
  20788. opened_input_global = input_name;
  20789. opened_input_global.focus();
  20790. opened_input_global.css({
  20791. width: inputWidth
  20792. });
  20793. }).trigger('input');
  20794. input_name.focusout(function () {
  20795. /// update array:
  20796. if (input_name.val().trim().length > 0) {
  20797. updateName(global_var, input_name.val().trim(), global_container);
  20798. global_container.find('.span_name_variable').text(global_var.name);
  20799. } else {
  20800. global_container.find('.span_name_variable').text(global_var.name);
  20801. }
  20802. input_name.off();
  20803. input_name.remove();
  20804. /// update elements:
  20805. opened_name_global = false;
  20806. opened_input_global = false;
  20807. });
  20808. input_name.on('keydown', function (e) {
  20809. var code = e.keyCode || e.which;
  20810. if (code == 13) {
  20811. if (input_name.val().trim()) {
  20812. updateName(global_var, input_name.val().trim(), global_container);
  20813. global_container.find('.span_name_variable').text(global_var.name);
  20814. } else {
  20815. global_container.find('.span_name_variable').text(global_var.name);
  20816. }
  20817. input_name.off();
  20818. input_name.remove();
  20819. /// update elements:
  20820. opened_name_global = false;
  20821. opened_input_global = false;
  20822. }
  20823. if (code == 27) {
  20824. global_container.find('.span_name_variable').text(global_var.name);
  20825. input_name.off();
  20826. input_name.remove();
  20827. /// update elements:
  20828. opened_name_global = false;
  20829. opened_input_global = false;
  20830. }
  20831. });
  20832. input_name.select();
  20833. }
  20834. var opened_name_value_vector_global_ = false;
  20835. var opened_input_value_vector_global_ = null;
  20836. function enableGlobalVectorValueUpdate(global_var, index, parent_node) {
  20837. if (opened_name_value_vector_global_) {
  20838. opened_input_value_vector_global_.focus();
  20839. return;
  20840. }
  20841. parent_node = (0, _jquery2.default)(parent_node);
  20842. opened_name_value_vector_global_ = true;
  20843. parent_node.find('.span_value_variable').text('');
  20844. var input_field;
  20845. if (global_var.type == _types.Types.REAL) {
  20846. 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) + "' />");
  20847. input_field.insertBefore(parent_node.find('.span_value_variable'));
  20848. } else {
  20849. 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] + "' />");
  20850. input_field.insertBefore(parent_node.find('.span_value_variable'));
  20851. }
  20852. input_field.on('input', function () {
  20853. var inputWidth = input_field.textWidth() + 10;
  20854. opened_input_value_vector_global_ = input_field;
  20855. input_field.focus();
  20856. var tmpStr = input_field.val();
  20857. input_field.val('');
  20858. input_field.val(tmpStr);
  20859. input_field.css({
  20860. width: inputWidth
  20861. });
  20862. }).trigger('input');
  20863. input_field.focusout(function () {
  20864. /// update array:
  20865. if (input_field.val().trim()) {
  20866. if (global_var.type == _types.Types.REAL) {
  20867. global_var.value[index] = parseFloat(input_field.val().trim());
  20868. parent_node.find('.span_value_variable').text(global_var.value[index].toFixed(1));
  20869. } else {
  20870. if (global_var.type == _types.Types.INTEGER) {
  20871. global_var.value[index] = parseInt(input_field.val().trim());
  20872. } else {
  20873. global_var.value[index] = input_field.val().trim();
  20874. }
  20875. parent_node.find('.span_value_variable').text(global_var.value[index]);
  20876. }
  20877. } else {
  20878. if (global_var.type == _types.Types.REAL) {
  20879. parent_node.find('.span_value_variable').text(global_var.value[index].toFixed(1));
  20880. } else {
  20881. parent_node.find('.span_value_variable').text(global_var.value[index]);
  20882. }
  20883. }
  20884. if (global_var.type == _types.Types.TEXT) {
  20885. global_var.value[index] = input_field.val();
  20886. parent_node.find('.span_value_variable').text(global_var.value[index]);
  20887. }
  20888. input_field.off();
  20889. input_field.remove();
  20890. /// update elements:
  20891. opened_name_value_vector_global_ = false;
  20892. opened_input_value_vector_global_ = false;
  20893. });
  20894. input_field.on('keydown', function (e) {
  20895. var code = e.keyCode || e.which;
  20896. if (code == 13) {
  20897. if (input_field.val().trim()) {
  20898. if (global_var.type == _types.Types.REAL) {
  20899. global_var.value[index] = parseFloat(input_field.val().trim());
  20900. parent_node.find('.span_value_variable').text(global_var.value[index].toFixed(1));
  20901. } else {
  20902. if (global_var.type == _types.Types.INTEGER) {
  20903. global_var.value[index] = parseInt(input_field.val().trim());
  20904. } else {
  20905. global_var.value[index] = input_field.val().trim();
  20906. }
  20907. parent_node.find('.span_value_variable').text(global_var.value[index]);
  20908. }
  20909. } else {
  20910. if (global_var.type == _types.Types.REAL) {
  20911. parent_node.find('.span_value_variable').text(global_var.value[index].toFixed(1));
  20912. } else {
  20913. parent_node.find('.span_value_variable').text(global_var.value[index]);
  20914. }
  20915. }
  20916. if (global_var.type == _types.Types.TEXT) {
  20917. global_var.value[index] = input_field.val();
  20918. parent_node.find('.span_value_variable').text(global_var.value[index]);
  20919. }
  20920. input_field.off();
  20921. input_field.remove();
  20922. /// update elements:
  20923. opened_name_value_vector_global_ = false;
  20924. opened_input_value_vector_global_ = false;
  20925. }
  20926. if (code == 27) {
  20927. if (global_var.type == _types.Types.REAL) {
  20928. parent_node.find('.span_value_variable').text(global_var.value[index].toFixed(1));
  20929. } else {
  20930. parent_node.find('.span_value_variable').text(global_var.value[index]);
  20931. }
  20932. input_field.off();
  20933. input_field.remove();
  20934. /// update elements:
  20935. opened_name_value_vector_global_ = false;
  20936. opened_input_value_vector_global_ = false;
  20937. }
  20938. });
  20939. input_field.select();
  20940. }
  20941. _jquery2.default.fn.textWidth = function (text, font) {
  20942. if (!_jquery2.default.fn.textWidth.fakeEl) _jquery2.default.fn.textWidth.fakeEl = (0, _jquery2.default)('<span>').hide().appendTo(document.body);
  20943. _jquery2.default.fn.textWidth.fakeEl.text(text || this.val() || this.text() || this.attr('placeholder')).css('font', font || this.css('font'));
  20944. return _jquery2.default.fn.textWidth.fakeEl.width();
  20945. };
  20946. /***/ }),
  20947. /***/ "./js/visualUI/ivprog_elements.js":
  20948. /*!****************************************!*\
  20949. !*** ./js/visualUI/ivprog_elements.js ***!
  20950. \****************************************/
  20951. /*! no static exports found */
  20952. /***/ (function(module, exports, __webpack_require__) {
  20953. "use strict";
  20954. Object.defineProperty(exports, "__esModule", {
  20955. value: true
  20956. });
  20957. 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;
  20958. 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; }; }();
  20959. var _variable_value_menu = __webpack_require__(/*! ./commands/variable_value_menu */ "./js/visualUI/commands/variable_value_menu.js");
  20960. var VariableValueMenuManagement = _interopRequireWildcard(_variable_value_menu);
  20961. var _types = __webpack_require__(/*! ./types */ "./js/visualUI/types.js");
  20962. var _melankeWatchjs = __webpack_require__(/*! melanke-watchjs */ "./node_modules/melanke-watchjs/src/watch.js");
  20963. var _melankeWatchjs2 = _interopRequireDefault(_melankeWatchjs);
  20964. var _algorithm = __webpack_require__(/*! ./algorithm */ "./js/visualUI/algorithm.js");
  20965. var AlgorithmManagement = _interopRequireWildcard(_algorithm);
  20966. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  20967. 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; } }
  20968. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  20969. var COMMAND_TYPES = exports.COMMAND_TYPES = Object.freeze({ function: "function", comment: "comment", reader: "reader", writer: "writer", attribution: "attribution", iftrue: "iftrue",
  20970. repeatNtimes: "repeatNtimes", whiletrue: "whiletrue", dowhiletrue: "dowhiletrue", switch: "switch", switchcase: "switchcase", functioncall: "functioncall", break: "break",
  20971. return: "return" });
  20972. var ARITHMETIC_TYPES = exports.ARITHMETIC_TYPES = Object.freeze({ plus: "plus", minus: "minus", multiplication: "multiplication", division: "division", module: "module", none: "none" });
  20973. 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" });
  20974. var EXPRESSION_TYPES = exports.EXPRESSION_TYPES = Object.freeze({ exp_conditional: "exp_conditional", exp_logic: "exp_logic", exp_arithmetic: "exp_arithmetic" });
  20975. 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" });
  20976. var LOGIC_COMPARISON = exports.LOGIC_COMPARISON = Object.freeze({ equals_to: "equals_to", not_equals_to: "not_equals_to", and: "and", or: "or" });
  20977. var SYSTEM_FUNCTIONS_CATEGORIES = exports.SYSTEM_FUNCTIONS_CATEGORIES = Object.freeze({ math: "math", text: "text_t", arrangement: "arrangement", conversion: "conversion" });
  20978. var Variable = exports.Variable = function Variable(type, name, value) {
  20979. var dimensions = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
  20980. var is_constant = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
  20981. var rows = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 0;
  20982. var columns = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : 0;
  20983. _classCallCheck(this, Variable);
  20984. this.type = type;
  20985. this.name = name;
  20986. this.value = value;
  20987. this.dimensions = dimensions;
  20988. this.is_constant = is_constant;
  20989. this.rows = rows;
  20990. this.columns = columns;
  20991. };
  20992. var Function = exports.Function = function Function(name) {
  20993. var return_type = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _types.Types.VOID;
  20994. var return_dimensions = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
  20995. var parameters_list = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : [];
  20996. var is_main = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
  20997. var is_hidden = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : false;
  20998. var variables_list = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : [];
  20999. var function_comment = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : null;
  21000. var commands = arguments.length > 8 && arguments[8] !== undefined ? arguments[8] : [];
  21001. _classCallCheck(this, Function);
  21002. this.type = COMMAND_TYPES.function;
  21003. this.name = name;
  21004. this.return_type = return_type;
  21005. this.return_dimensions = return_dimensions;
  21006. this.parameters_list = parameters_list;
  21007. this.is_main = is_main;
  21008. this.is_hidden = is_hidden;
  21009. this.variables_list = variables_list;
  21010. this.function_comment = function_comment;
  21011. this.commands = commands;
  21012. };
  21013. var SystemFunction = exports.SystemFunction = function SystemFunction(identifier, return_type, return_dimensions, parameters_list) {
  21014. var function_comment = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : null;
  21015. var category = arguments[5];
  21016. _classCallCheck(this, SystemFunction);
  21017. this.type = COMMAND_TYPES.function;
  21018. this.identifier = identifier;
  21019. this.return_type = return_type;
  21020. this.return_dimensions = return_dimensions;
  21021. this.parameters_list = parameters_list;
  21022. this.function_comment = function_comment;
  21023. this.category = category;
  21024. };
  21025. var Comment = exports.Comment = function Comment(comment_text) {
  21026. _classCallCheck(this, Comment);
  21027. this.type = COMMAND_TYPES.comment;
  21028. this.comment_text = comment_text;
  21029. };
  21030. var Break = exports.Break = function Break() {
  21031. _classCallCheck(this, Break);
  21032. this.type = COMMAND_TYPES.break;
  21033. };
  21034. var Reader = exports.Reader = function Reader() {
  21035. var variable_value_menu = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : new VariableValueMenu();
  21036. _classCallCheck(this, Reader);
  21037. this.type = COMMAND_TYPES.reader;
  21038. this.variable_value_menu = variable_value_menu;
  21039. };
  21040. var Writer = exports.Writer = function Writer(content) {
  21041. _classCallCheck(this, Writer);
  21042. this.type = COMMAND_TYPES.writer;
  21043. this.content = content;
  21044. };
  21045. var Attribution = exports.Attribution = function Attribution(variable) {
  21046. var expression = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
  21047. _classCallCheck(this, Attribution);
  21048. this.type = COMMAND_TYPES.attribution;
  21049. this.variable = variable;
  21050. this.expression = expression;
  21051. };
  21052. var ExpressionElement = exports.ExpressionElement = function ExpressionElement(type_exp) {
  21053. var itens = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
  21054. _classCallCheck(this, ExpressionElement);
  21055. this.type_exp = type_exp;
  21056. this.itens = itens;
  21057. };
  21058. var ConditionalExpression = exports.ConditionalExpression = function ConditionalExpression(expression) {
  21059. _classCallCheck(this, ConditionalExpression);
  21060. this.type = EXPRESSION_TYPES.exp_conditional;
  21061. this.expression = expression;
  21062. };
  21063. var LogicExpression = exports.LogicExpression = function LogicExpression(has_neg, first_operand, second_operand, operator) {
  21064. _classCallCheck(this, LogicExpression);
  21065. this.type = EXPRESSION_TYPES.exp_logic;
  21066. this.has_neg = has_neg;
  21067. this.first_operand = first_operand;
  21068. this.second_operand = second_operand;
  21069. this.operator = operator;
  21070. };
  21071. var ArithmeticExpression = exports.ArithmeticExpression = function ArithmeticExpression(first_operand, second_operand, operator) {
  21072. _classCallCheck(this, ArithmeticExpression);
  21073. this.type = EXPRESSION_TYPES.exp_arithmetic;
  21074. this.first_operand = first_operand;
  21075. this.second_operand = second_operand;
  21076. this.operator = operator;
  21077. };
  21078. var IfTrue = exports.IfTrue = function IfTrue(expression, commands_block, commands_else) {
  21079. _classCallCheck(this, IfTrue);
  21080. this.type = COMMAND_TYPES.iftrue;
  21081. this.expression = expression;
  21082. this.commands_block = commands_block;
  21083. this.commands_else = commands_else;
  21084. };
  21085. var RepeatNTimes = exports.RepeatNTimes = function RepeatNTimes(var_attribution, var_incrementation, expression1, expression2, expression3, commands_block) {
  21086. _classCallCheck(this, RepeatNTimes);
  21087. this.type = COMMAND_TYPES.repeatNtimes;
  21088. this.var_attribution = var_attribution;
  21089. this.var_incrementation = var_incrementation;
  21090. this.expression1 = expression1;
  21091. this.expression2 = expression2;
  21092. this.expression3 = expression3;
  21093. this.commands_block = commands_block;
  21094. };
  21095. var WhileTrue = exports.WhileTrue = function WhileTrue(expression, commands_block) {
  21096. _classCallCheck(this, WhileTrue);
  21097. this.type = COMMAND_TYPES.whiletrue;
  21098. this.expression = expression;
  21099. this.commands_block = commands_block;
  21100. };
  21101. var DoWhileTrue = exports.DoWhileTrue = function DoWhileTrue(expression, commands_block) {
  21102. _classCallCheck(this, DoWhileTrue);
  21103. this.type = COMMAND_TYPES.dowhiletrue;
  21104. this.expression = expression;
  21105. this.commands_block = commands_block;
  21106. };
  21107. var Switch = exports.Switch = function Switch(variable) {
  21108. var cases = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
  21109. _classCallCheck(this, Switch);
  21110. this.type = COMMAND_TYPES.switch;
  21111. this.variable = variable;
  21112. this.cases = cases;
  21113. };
  21114. var Return = exports.Return = function Return(variable_value_menu) {
  21115. _classCallCheck(this, Return);
  21116. this.type = COMMAND_TYPES.return;
  21117. this.variable_value_menu = variable_value_menu;
  21118. };
  21119. var SwitchCase = exports.SwitchCase = function SwitchCase(variable_value_menu) {
  21120. var commands_block = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
  21121. _classCallCheck(this, SwitchCase);
  21122. this.type = COMMAND_TYPES.switchcase;
  21123. this.variable_value_menu = variable_value_menu;
  21124. this.commands_block = commands_block;
  21125. };
  21126. var FunctionCall = exports.FunctionCall = function FunctionCall(function_called, parameters_list) {
  21127. _classCallCheck(this, FunctionCall);
  21128. this.type = COMMAND_TYPES.functioncall;
  21129. this.function_called = function_called;
  21130. this.parameters_list = parameters_list;
  21131. };
  21132. var VariableValueMenu = exports.VariableValueMenu = function VariableValueMenu() {
  21133. var variable_and_value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 7;
  21134. var content = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
  21135. var row = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
  21136. var column = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
  21137. var include_constant = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : true;
  21138. var dimensions = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 0;
  21139. _classCallCheck(this, VariableValueMenu);
  21140. this.type = "var_value";
  21141. this.variable_and_value = variable_and_value;
  21142. this.content = content;
  21143. this.row = row;
  21144. this.column = column;
  21145. this.include_constant = include_constant;
  21146. this.dimensions = dimensions;
  21147. };
  21148. var FunctionCallMenu = exports.FunctionCallMenu = function FunctionCallMenu() {
  21149. var function_called = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
  21150. var parameters_list = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
  21151. _classCallCheck(this, FunctionCallMenu);
  21152. this.type = "function_call";
  21153. this.function_called = function_called;
  21154. this.parameters_list = parameters_list;
  21155. };
  21156. var Program = exports.Program = function () {
  21157. function Program() {
  21158. _classCallCheck(this, Program);
  21159. this.functions = [];
  21160. this.globals = [];
  21161. }
  21162. _createClass(Program, [{
  21163. key: 'addFunction',
  21164. value: function addFunction(function_to_add) {
  21165. _melankeWatchjs2.default.watch(function_to_add.parameters_list, function () {
  21166. if (window.insertContext) {
  21167. setTimeout(function () {
  21168. AlgorithmManagement.renderAlgorithm();
  21169. }, 300);
  21170. window.insertContext = false;
  21171. } else {
  21172. AlgorithmManagement.renderAlgorithm();
  21173. }
  21174. }, 1);
  21175. _melankeWatchjs2.default.watch(function_to_add.variables_list, function () {
  21176. if (window.insertContext) {
  21177. setTimeout(function () {
  21178. AlgorithmManagement.renderAlgorithm();
  21179. }, 300);
  21180. window.insertContext = false;
  21181. } else {
  21182. AlgorithmManagement.renderAlgorithm();
  21183. }
  21184. }, 1);
  21185. this.functions.push(function_to_add);
  21186. }
  21187. }, {
  21188. key: 'addVariable',
  21189. value: function addVariable(function_to_receive, variable) {
  21190. if (this.functions[function_to_receive].variable === null) {
  21191. this.functions[function_to_receive].variables_list = [];
  21192. }
  21193. this.functions[function_to_receive].variables_list.push(variable);
  21194. }
  21195. }, {
  21196. key: 'addGlobal',
  21197. value: function addGlobal(variable) {
  21198. this.globals.push(variable);
  21199. }
  21200. }]);
  21201. return Program;
  21202. }();
  21203. /***/ }),
  21204. /***/ "./js/visualUI/types.js":
  21205. /*!******************************!*\
  21206. !*** ./js/visualUI/types.js ***!
  21207. \******************************/
  21208. /*! no static exports found */
  21209. /***/ (function(module, exports, __webpack_require__) {
  21210. "use strict";
  21211. Object.defineProperty(exports, "__esModule", {
  21212. value: true
  21213. });
  21214. var Types = exports.Types = Object.freeze({
  21215. INTEGER: "integer",
  21216. REAL: "real",
  21217. TEXT: "text",
  21218. BOOLEAN: "boolean",
  21219. VOID: "void"
  21220. });
  21221. /***/ }),
  21222. /***/ "./js/visualUI/utils.js":
  21223. /*!******************************!*\
  21224. !*** ./js/visualUI/utils.js ***!
  21225. \******************************/
  21226. /*! no static exports found */
  21227. /***/ (function(module, exports, __webpack_require__) {
  21228. "use strict";
  21229. Object.defineProperty(exports, "__esModule", {
  21230. value: true
  21231. });
  21232. exports.renderErrorMessage = renderErrorMessage;
  21233. var _jquery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  21234. var _jquery2 = _interopRequireDefault(_jquery);
  21235. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  21236. function renderErrorMessage(dom_obj_target, message_text) {
  21237. dom_obj_target.popup({
  21238. html: '<i class="ui icon inverted exclamation triangle yellow"></i>' + message_text,
  21239. transition: "fade up",
  21240. on: 'click',
  21241. closable: true,
  21242. movePopup: true,
  21243. boundary: window,
  21244. preserve: false,
  21245. target: false,
  21246. className: {
  21247. popup: 'ui popup invalid-identifier'
  21248. },
  21249. onHidden: function onHidden($module) {
  21250. dom_obj_target.popup('destroy');
  21251. }
  21252. }).popup('toggle');
  21253. }
  21254. /***/ }),
  21255. /***/ "./js/visualUI/variables.js":
  21256. /*!**********************************!*\
  21257. !*** ./js/visualUI/variables.js ***!
  21258. \**********************************/
  21259. /*! no static exports found */
  21260. /***/ (function(module, exports, __webpack_require__) {
  21261. "use strict";
  21262. Object.defineProperty(exports, "__esModule", {
  21263. value: true
  21264. });
  21265. exports.addVariable = addVariable;
  21266. exports.renderVariable = renderVariable;
  21267. var _jquery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  21268. var _jquery2 = _interopRequireDefault(_jquery);
  21269. var _types = __webpack_require__(/*! ./types */ "./js/visualUI/types.js");
  21270. var _ivprog_elements = __webpack_require__(/*! ./ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  21271. var Models = _interopRequireWildcard(_ivprog_elements);
  21272. var _localizedStringsService = __webpack_require__(/*! ./../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  21273. var _utils = __webpack_require__(/*! ./utils */ "./js/visualUI/utils.js");
  21274. var Utils = _interopRequireWildcard(_utils);
  21275. __webpack_require__(/*! ../semantic/semantic.min.js */ "./js/semantic/semantic.min.js");
  21276. 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; } }
  21277. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  21278. window.jQuery = _jquery2.default;
  21279. var counter_new_variables = 0;
  21280. function addVariable(function_obj, function_container) {
  21281. var is_in_click = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  21282. var new_var = new Models.Variable(_types.Types.INTEGER, _localizedStringsService.LocalizedStrings.getUI('new_variable') + '_' + counter_new_variables, 1);
  21283. if (function_obj.variables_list == null) {
  21284. function_obj.variables_list = [];
  21285. }
  21286. function_obj.variables_list.push(new_var);
  21287. counter_new_variables++;
  21288. var newe = renderVariable(function_container, new_var, function_obj);
  21289. if (is_in_click) {
  21290. newe.css('display', 'none');
  21291. newe.fadeIn();
  21292. }
  21293. }
  21294. function updateName(variable_obj, new_name, variable_obj_dom, function_obj) {
  21295. if (variable_obj.name == new_name) {
  21296. return;
  21297. }
  21298. if (isValidIdentifier(new_name)) {
  21299. if (variableNameAlreadyExists(new_name, function_obj)) {
  21300. Utils.renderErrorMessage(variable_obj_dom.find('.editing_name_var'), _localizedStringsService.LocalizedStrings.getUI('inform_valid_variable_duplicated'));
  21301. } else {
  21302. variable_obj.name = new_name;
  21303. }
  21304. } else {
  21305. Utils.renderErrorMessage(variable_obj_dom.find('.editing_name_var'), _localizedStringsService.LocalizedStrings.getUI('inform_valid_name'));
  21306. }
  21307. }
  21308. function variableNameAlreadyExists(name_var, function_obj) {
  21309. if (function_obj.parameters_list) {
  21310. for (var i = 0; i < function_obj.parameters_list.length; i++) {
  21311. if (function_obj.parameters_list[i].name == name_var) {
  21312. return true;
  21313. }
  21314. }
  21315. }
  21316. if (function_obj.variables_list) {
  21317. for (var i = 0; i < function_obj.variables_list.length; i++) {
  21318. if (function_obj.variables_list[i].name == name_var) {
  21319. return true;
  21320. }
  21321. }
  21322. }
  21323. return false;
  21324. }
  21325. function isValidIdentifier(identifier_str) {
  21326. return (/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(identifier_str)
  21327. );
  21328. }
  21329. function removeVariable(variable_obj, variable_container) {
  21330. var function_associated = variable_container.data('associatedFunction');
  21331. var index = function_associated.variables_list.indexOf(variable_obj);
  21332. if (index > -1) {
  21333. window.insertContext = true;
  21334. delete function_associated.variables_list[index];
  21335. function_associated.variables_list.splice(index, 1);
  21336. }
  21337. variable_container.children().off();
  21338. variable_container.off();
  21339. variable_container.fadeOut();
  21340. }
  21341. function updateType(variable_obj, new_type) {
  21342. var new_dimensions = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
  21343. variable_obj.type = new_type;
  21344. variable_obj.dimensions = new_dimensions;
  21345. if (new_dimensions > 0) {
  21346. variable_obj.rows = new_dimensions;
  21347. variable_obj.columns = 2;
  21348. }
  21349. updateInitialValues(variable_obj);
  21350. }
  21351. function addHandlers(variable_obj, variable_container, function_obj) {
  21352. // Manage variable name:
  21353. variable_container.find(".enable_edit_name_variable").on('click', function (e) {
  21354. enableNameUpdate(variable_obj, variable_container, function_obj);
  21355. });
  21356. // Menu to change type:
  21357. variable_container.find('.ui.dropdown.variable_type').dropdown({
  21358. onChange: function onChange(value, text, $selectedItem) {
  21359. if ($selectedItem.data('dimensions')) {
  21360. updateType(variable_obj, _types.Types[$selectedItem.data('type')], $selectedItem.data('dimensions'));
  21361. } else {
  21362. updateType(variable_obj, _types.Types[$selectedItem.data('type')]);
  21363. }
  21364. renderValues(variable_obj, variable_container);
  21365. },
  21366. selectOnKeydown: false
  21367. });
  21368. // Remove variable:
  21369. variable_container.find(".remove_variable").on('click', function (e) {
  21370. removeVariable(variable_obj, variable_container);
  21371. });
  21372. }
  21373. function renderVariable(function_container, new_var, function_obj) {
  21374. var element = '<div class="ui label variable_container pink"><i class="ui icon ellipsis vertical inverted"></i>';
  21375. element += '<div class="ui dropdown variable_type">';
  21376. if (new_var.dimensions > 0) {
  21377. element += '<div class="text">' + _localizedStringsService.LocalizedStrings.getUI('vector') + ':' + _localizedStringsService.LocalizedStrings.getUI(new_var.type.toLowerCase());
  21378. for (var i = 0; i < new_var.dimensions; i++) {
  21379. element += ' [ ] ';
  21380. }
  21381. element += '</div>';
  21382. } else {
  21383. element += '<div class="text">' + _localizedStringsService.LocalizedStrings.getUI(new_var.type.toLowerCase()) + '</div>';
  21384. }
  21385. element += '<div class="menu">';
  21386. for (var tm in _types.Types) {
  21387. if (tm == _types.Types.VOID.toUpperCase()) {
  21388. continue;
  21389. }
  21390. element += '<div class="item ' + (new_var.type == tm.toLowerCase() ? ' selected ' : '') + '" data-type="' + tm + '" >' + _localizedStringsService.LocalizedStrings.getUI(tm.toLowerCase()) + '</div>';
  21391. }
  21392. for (var tm in _types.Types) {
  21393. if (tm == _types.Types.VOID.toUpperCase()) {
  21394. continue;
  21395. }
  21396. 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>';
  21397. }
  21398. element += '</div></div> ';
  21399. element += '<div class="editing_name_var"><span class="span_name_variable enable_edit_name_variable">' + new_var.name + '</span> </div>';
  21400. element += ' <span class="character_equals"> = </span> <div class="ui div_valor_var">' + new_var.value + '</div>';
  21401. element += ' <i class="yellow inverted icon times remove_variable"></i></div>';
  21402. element = (0, _jquery2.default)(element);
  21403. element.data('associatedFunction', function_obj);
  21404. function_container.find('.variables_list_div').append(element);
  21405. addHandlers(new_var, element, function_obj);
  21406. renderValues(new_var, element);
  21407. return element;
  21408. }
  21409. function updateColumnsAndRowsText(variable_container, variable_var) {
  21410. var prev = variable_container.find('.text').text().split('[');
  21411. if (prev.length == 2) {
  21412. var ff = prev[0] + '[ ' + variable_var.columns + ' ] ';
  21413. variable_container.find('.text').empty();
  21414. variable_container.find('.text').text(ff);
  21415. }
  21416. if (prev.length == 3) {
  21417. var ff = prev[0] + '[ ' + variable_var.columns + ' ] [ ' + variable_var.rows + ' ] ';
  21418. variable_container.find('.text').empty();
  21419. variable_container.find('.text').text(ff);
  21420. }
  21421. }
  21422. function renderValues(new_var, variable_container) {
  21423. var ret = "";
  21424. var j = 0;
  21425. if (new_var.dimensions == 0) {
  21426. if (new_var.type == _types.Types.REAL) {
  21427. ret += '<div class="created_div_valor_var"><span class="span_value_variable simple_var">' + new_var.value.toFixed(1) + '</span> </div> ';
  21428. } else {
  21429. if (new_var.type == _types.Types.BOOLEAN) {
  21430. ret += '<div class="created_div_valor_var"><span class="span_value_variable boolean_simple_type">' + _localizedStringsService.LocalizedStrings.getUI(new_var.value) + '</span> </div> ';
  21431. } else {
  21432. ret += '<div class="created_div_valor_var"><span class="span_value_variable simple_var">' + new_var.value + '</span> </div> ';
  21433. }
  21434. }
  21435. } else {
  21436. ret += '<table class="tabela_var">';
  21437. if (new_var.dimensions == 1) {
  21438. ret += '<tr>';
  21439. if (new_var.type == _types.Types.REAL) {
  21440. for (var k = 0; k < new_var.columns; k++) {
  21441. ret += '<td><span class="span_value_variable vector_var" data-index="' + k + '">' + new_var.value[k].toFixed(1) + '</span></td>';
  21442. }
  21443. } else {
  21444. for (var k = 0; k < new_var.columns; k++) {
  21445. if (new_var.type == _types.Types.BOOLEAN) {
  21446. ret += '<td><span class="span_value_variable boolean_vector_var" data-index="' + k + '">' + _localizedStringsService.LocalizedStrings.getUI(new_var.value[k]) + '</span></td>';
  21447. } else {
  21448. ret += '<td><span class="span_value_variable vector_var" data-index="' + k + '">' + new_var.value[k] + '</span>' + '</td>';
  21449. }
  21450. }
  21451. }
  21452. ret += '</tr>';
  21453. ret += '</table>';
  21454. 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>';
  21455. }
  21456. if (new_var.dimensions == 2) {
  21457. if (new_var.type == _types.Types.REAL) {
  21458. for (var l = 0; l < new_var.rows; l++) {
  21459. ret += '<tr>';
  21460. for (var k = 0; k < new_var.columns; k++) {
  21461. ret += '<td><span class="span_value_variable matrix_var" data-index="' + k + '" data-row="' + l + '">' + new_var.value[l][k].toFixed(1) + '</span>' + '</td>';
  21462. }
  21463. ret += '</tr>';
  21464. }
  21465. } else {
  21466. for (var l = 0; l < new_var.rows; l++) {
  21467. ret += '<tr>';
  21468. for (var k = 0; k < new_var.columns; k++) {
  21469. if (new_var.type == _types.Types.BOOLEAN) {
  21470. 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>';
  21471. } else {
  21472. ret += '<td><span class="span_value_variable matrix_var" data-index="' + k + '" data-row="' + l + '">' + new_var.value[l][k] + '</span></td>';
  21473. }
  21474. }
  21475. ret += '</tr>';
  21476. }
  21477. }
  21478. if (new_var.rows == 0) {
  21479. ret += '<tr><td></td></tr>';
  21480. }
  21481. 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>';
  21482. ret += '</table>';
  21483. 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>';
  21484. }
  21485. }
  21486. (0, _jquery2.default)(variable_container).find(".div_valor_var").html('');
  21487. ret = (0, _jquery2.default)(ret);
  21488. (0, _jquery2.default)(ret).find('.span_value_variable').data('associatedOject', new_var);
  21489. (0, _jquery2.default)(ret).find(".boolean_simple_type").on('click', function (e) {
  21490. alternateBooleanValue(new_var, this.parentNode);
  21491. });
  21492. (0, _jquery2.default)(ret).find(".simple_var").on('click', function (e) {
  21493. enableValueUpdate(new_var, this.parentNode);
  21494. });
  21495. (0, _jquery2.default)(ret).find(".boolean_vector_var").on('click', function (e) {
  21496. alternateBooleanVectorValue(new_var, (0, _jquery2.default)(this).data('index'), this.parentNode);
  21497. });
  21498. (0, _jquery2.default)(ret).find(".vector_var").on('click', function (e) {
  21499. enableVectorValueUpdate(new_var, (0, _jquery2.default)(this).data('index'), this.parentNode);
  21500. });
  21501. (0, _jquery2.default)(ret).find(".remove_global_vector_column").on('click', function (e) {
  21502. removeColumnVector(new_var);
  21503. (0, _jquery2.default)(variable_container).find(".div_valor_var").html('');
  21504. renderValues(new_var, variable_container);
  21505. });
  21506. (0, _jquery2.default)(ret).find(".add_global_vector_column").on('click', function (e) {
  21507. addColumnVector(new_var);
  21508. (0, _jquery2.default)(variable_container).find(".div_valor_var").html('');
  21509. renderValues(new_var, variable_container);
  21510. });
  21511. (0, _jquery2.default)(ret).find(".remove_global_matrix_column").on('click', function (e) {
  21512. removeColumnMatrix(new_var);
  21513. (0, _jquery2.default)(variable_container).find(".div_valor_var").html('');
  21514. renderValues(new_var, variable_container);
  21515. });
  21516. (0, _jquery2.default)(ret).find(".add_global_matrix_column").on('click', function (e) {
  21517. addColumnMatrix(new_var);
  21518. (0, _jquery2.default)(variable_container).find(".div_valor_var").html('');
  21519. renderValues(new_var, variable_container);
  21520. });
  21521. (0, _jquery2.default)(ret).find(".remove_global_matrix_line").on('click', function (e) {
  21522. removeLineMatrix(new_var);
  21523. (0, _jquery2.default)(variable_container).find(".div_valor_var").html('');
  21524. renderValues(new_var, variable_container);
  21525. });
  21526. (0, _jquery2.default)(ret).find(".add_global_matrix_line").on('click', function (e) {
  21527. addLineMatrix(new_var);
  21528. (0, _jquery2.default)(variable_container).find(".div_valor_var").html('');
  21529. renderValues(new_var, variable_container);
  21530. });
  21531. (0, _jquery2.default)(ret).find(".boolean_matrix_var").on('click', function (e) {
  21532. alternateBooleanMatrixValue(new_var, (0, _jquery2.default)(this).data('row'), (0, _jquery2.default)(this).data('index'), this.parentNode);
  21533. });
  21534. (0, _jquery2.default)(ret).find(".matrix_var").on('click', function (e) {
  21535. enableMatrixValueUpdate(new_var, (0, _jquery2.default)(this).data('row'), (0, _jquery2.default)(this).data('index'), this.parentNode);
  21536. });
  21537. (0, _jquery2.default)(variable_container).find(".div_valor_var").append(ret);
  21538. updateColumnsAndRowsText(variable_container, new_var);
  21539. }
  21540. function alternateBooleanMatrixValue(var_obj, row, index, value_container) {
  21541. var_obj.value[row][index] = !var_obj.value[row][index];
  21542. (0, _jquery2.default)(value_container).find('.span_value_variable').text(_localizedStringsService.LocalizedStrings.getUI(var_obj.value[row][index]));
  21543. }
  21544. function addLineMatrix(var_obj) {
  21545. var_obj.rows++;
  21546. if (var_obj.type == _types.Types.INTEGER) {
  21547. var n_l = [];
  21548. for (var i = 0; i < var_obj.columns; i++) {
  21549. n_l.push(1);
  21550. }
  21551. var_obj.value.push(n_l);
  21552. }
  21553. if (var_obj.type == _types.Types.REAL) {
  21554. var n_l = [];
  21555. for (i = 0; i < var_obj.columns; i++) {
  21556. n_l.push(1.0);
  21557. }
  21558. var_obj.value.push(n_l);
  21559. }
  21560. if (var_obj.type == _types.Types.TEXT) {
  21561. var n_l = [];
  21562. for (i = 0; i < var_obj.columns; i++) {
  21563. n_l.push(_localizedStringsService.LocalizedStrings.getUI('text_start'));
  21564. }
  21565. var_obj.value.push(n_l);
  21566. }
  21567. if (var_obj.type == _types.Types.BOOLEAN) {
  21568. var n_l = [];
  21569. for (i = 0; i < var_obj.columns; i++) {
  21570. n_l.push(true);
  21571. }
  21572. var_obj.value.push(n_l);
  21573. }
  21574. }
  21575. function removeLineMatrix(var_obj) {
  21576. if (var_obj.rows == 0) {
  21577. return;
  21578. }
  21579. var_obj.rows--;
  21580. var_obj.value.splice(var_obj.value.length - 1, 1);
  21581. }
  21582. function addColumnMatrix(var_obj) {
  21583. var_obj.columns++;
  21584. if (var_obj.type == _types.Types.INTEGER) {
  21585. for (var i = 0; i < var_obj.rows; i++) {
  21586. var_obj.value[i].push(1);
  21587. }
  21588. }
  21589. if (var_obj.type == _types.Types.REAL) {
  21590. for (var i = 0; i < var_obj.rows; i++) {
  21591. var_obj.value[i].push(1.0);
  21592. }
  21593. }
  21594. if (var_obj.type == _types.Types.TEXT) {
  21595. for (var i = 0; i < var_obj.rows; i++) {
  21596. var_obj.value[i].push(_localizedStringsService.LocalizedStrings.getUI('text_start'));
  21597. }
  21598. }
  21599. if (var_obj.type == _types.Types.BOOLEAN) {
  21600. for (var i = 0; i < var_obj.rows; i++) {
  21601. var_obj.value[i].push(true);
  21602. }
  21603. }
  21604. }
  21605. function removeColumnMatrix(var_obj) {
  21606. if (var_obj.columns == 0) {
  21607. return;
  21608. }
  21609. var_obj.columns--;
  21610. for (var i = 0; i < var_obj.rows; i++) {
  21611. var_obj.value[i].splice(var_obj.value[i].length - 1, 1);
  21612. }
  21613. }
  21614. function addColumnVector(var_obj) {
  21615. var_obj.columns++;
  21616. if (var_obj.type == _types.Types.INTEGER) {
  21617. var_obj.value.push(1);
  21618. }
  21619. if (var_obj.type == _types.Types.REAL) {
  21620. var_obj.value.push(1.0);
  21621. }
  21622. if (var_obj.type == _types.Types.TEXT) {
  21623. var_obj.value.push(_localizedStringsService.LocalizedStrings.getUI('text_start'));
  21624. }
  21625. if (var_obj.type == _types.Types.BOOLEAN) {
  21626. var_obj.value.push(true);
  21627. }
  21628. }
  21629. function removeColumnVector(var_obj) {
  21630. if (var_obj.columns == 0) {
  21631. return;
  21632. }
  21633. var_obj.columns--;
  21634. var_obj.value.splice(var_obj.value.length - 1, 1);
  21635. }
  21636. function alternateBooleanValue(var_obj, value_container) {
  21637. var_obj.value = !var_obj.value;
  21638. (0, _jquery2.default)(value_container).find('.span_value_variable').text(_localizedStringsService.LocalizedStrings.getUI(var_obj.value));
  21639. }
  21640. function alternateBooleanVectorValue(var_obj, index, value_container) {
  21641. var_obj.value[index] = !var_obj.value[index];
  21642. (0, _jquery2.default)(value_container).find('.span_value_variable').text(_localizedStringsService.LocalizedStrings.getUI(var_obj.value[index]));
  21643. }
  21644. function updateInitialValues(variable_obj) {
  21645. if (variable_obj.type == _types.Types.INTEGER) {
  21646. if (variable_obj.dimensions == 0) {
  21647. variable_obj.value = 1;
  21648. }
  21649. if (variable_obj.dimensions == 1) {
  21650. variable_obj.value = [1, 1];
  21651. }
  21652. if (variable_obj.dimensions == 2) {
  21653. variable_obj.value = [[1, 1], [1, 1]];
  21654. }
  21655. }
  21656. if (variable_obj.type == _types.Types.REAL) {
  21657. if (variable_obj.dimensions == 0) {
  21658. variable_obj.value = 1.0;
  21659. }
  21660. if (variable_obj.dimensions == 1) {
  21661. variable_obj.value = [1.0, 1.0];
  21662. }
  21663. if (variable_obj.dimensions == 2) {
  21664. variable_obj.value = [[1.0, 1.0], [1.0, 1.0]];
  21665. }
  21666. }
  21667. if (variable_obj.type == _types.Types.TEXT) {
  21668. if (variable_obj.dimensions == 0) {
  21669. variable_obj.value = _localizedStringsService.LocalizedStrings.getUI('text_start');
  21670. }
  21671. if (variable_obj.dimensions == 1) {
  21672. variable_obj.value = [_localizedStringsService.LocalizedStrings.getUI('text_start'), _localizedStringsService.LocalizedStrings.getUI('text_start')];
  21673. }
  21674. if (variable_obj.dimensions == 2) {
  21675. variable_obj.value = [[_localizedStringsService.LocalizedStrings.getUI('text_start'), _localizedStringsService.LocalizedStrings.getUI('text_start')], [_localizedStringsService.LocalizedStrings.getUI('text_start'), _localizedStringsService.LocalizedStrings.getUI('text_start')]];
  21676. }
  21677. }
  21678. if (variable_obj.type == _types.Types.BOOLEAN) {
  21679. if (variable_obj.dimensions == 0) {
  21680. variable_obj.value = true;
  21681. }
  21682. if (variable_obj.dimensions == 1) {
  21683. variable_obj.value = [true, true];
  21684. }
  21685. if (variable_obj.dimensions == 2) {
  21686. variable_obj.value = [[true, true], [true, true]];
  21687. }
  21688. }
  21689. }
  21690. var opened_name_value_vector_global_ = false;
  21691. var opened_input_value_vector_global_ = null;
  21692. function enableVectorValueUpdate(var_obj, index, parent_node) {
  21693. if (opened_name_value_vector_global_) {
  21694. opened_input_value_vector_global_.focus();
  21695. return;
  21696. }
  21697. parent_node = (0, _jquery2.default)(parent_node);
  21698. opened_name_value_vector_global_ = true;
  21699. parent_node.find('.span_value_variable').text('');
  21700. var input_field;
  21701. if (var_obj.type == _types.Types.REAL) {
  21702. 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) + "' />");
  21703. input_field.insertBefore(parent_node.find('.span_value_variable'));
  21704. } else {
  21705. 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] + "' />");
  21706. input_field.insertBefore(parent_node.find('.span_value_variable'));
  21707. }
  21708. input_field.on('input', function () {
  21709. var inputWidth = input_field.textWidth() + 10;
  21710. opened_input_value_vector_global_ = input_field;
  21711. input_field.focus();
  21712. var tmpStr = input_field.val();
  21713. input_field.val('');
  21714. input_field.val(tmpStr);
  21715. input_field.css({
  21716. width: inputWidth
  21717. });
  21718. }).trigger('input');
  21719. input_field.focusout(function () {
  21720. /// update array:
  21721. if (input_field.val().trim()) {
  21722. if (var_obj.type == _types.Types.REAL) {
  21723. var_obj.value[index] = parseFloat(input_field.val().trim());
  21724. parent_node.find('.span_value_variable').text(var_obj.value[index].toFixed(1));
  21725. } else {
  21726. if (var_obj.type == _types.Types.INTEGER) {
  21727. var_obj.value[index] = parseInt(input_field.val().trim());
  21728. } else {
  21729. var_obj.value[index] = input_field.val().trim();
  21730. }
  21731. parent_node.find('.span_value_variable').text(var_obj.value[index]);
  21732. }
  21733. } else {
  21734. if (var_obj.type == _types.Types.REAL) {
  21735. parent_node.find('.span_value_variable').text(var_obj.value[index].toFixed(1));
  21736. } else {
  21737. parent_node.find('.span_value_variable').text(var_obj.value[index]);
  21738. }
  21739. }
  21740. if (var_obj.type == _types.Types.TEXT) {
  21741. var_obj.value[index] = input_field.val();
  21742. parent_node.find('.span_value_variable').text(var_obj.value[index]);
  21743. }
  21744. input_field.off();
  21745. input_field.remove();
  21746. /// update elements:
  21747. opened_name_value_vector_global_ = false;
  21748. opened_input_value_vector_global_ = false;
  21749. });
  21750. input_field.on('keydown', function (e) {
  21751. var code = e.keyCode || e.which;
  21752. if (code == 13) {
  21753. if (input_field.val().trim()) {
  21754. if (var_obj.type == _types.Types.REAL) {
  21755. var_obj.value[index] = parseFloat(input_field.val().trim());
  21756. parent_node.find('.span_value_variable').text(var_obj.value[index].toFixed(1));
  21757. } else {
  21758. if (var_obj.type == _types.Types.INTEGER) {
  21759. var_obj.value[index] = parseInt(input_field.val().trim());
  21760. } else {
  21761. var_obj.value[index] = input_field.val().trim();
  21762. }
  21763. parent_node.find('.span_value_variable').text(var_obj.value[index]);
  21764. }
  21765. } else {
  21766. if (var_obj.type == _types.Types.REAL) {
  21767. parent_node.find('.span_value_variable').text(var_obj.value[index].toFixed(1));
  21768. } else {
  21769. parent_node.find('.span_value_variable').text(var_obj.value[index]);
  21770. }
  21771. }
  21772. if (var_obj.type == _types.Types.TEXT) {
  21773. var_obj.value[index] = input_field.val();
  21774. parent_node.find('.span_value_variable').text(var_obj.value[index]);
  21775. }
  21776. input_field.off();
  21777. input_field.remove();
  21778. /// update elements:
  21779. opened_name_value_vector_global_ = false;
  21780. opened_input_value_vector_global_ = false;
  21781. }
  21782. if (code == 27) {
  21783. if (var_obj.type == _types.Types.REAL) {
  21784. parent_node.find('.span_value_variable').text(var_obj.value[index].toFixed(1));
  21785. } else {
  21786. parent_node.find('.span_value_variable').text(var_obj.value[index]);
  21787. }
  21788. input_field.off();
  21789. input_field.remove();
  21790. /// update elements:
  21791. opened_name_value_vector_global_ = false;
  21792. opened_input_value_vector_global_ = false;
  21793. }
  21794. });
  21795. input_field.select();
  21796. }
  21797. var opened_name_value_global_var = false;
  21798. var opened_input_value_global_ar = null;
  21799. function enableValueUpdate(var_obj, parent_node) {
  21800. if (opened_name_value_global_var) {
  21801. opened_input_value_global_ar.focus();
  21802. return;
  21803. }
  21804. parent_node = (0, _jquery2.default)(parent_node);
  21805. opened_name_value_global_var = true;
  21806. var input_field;
  21807. parent_node.find('.span_value_variable').text('');
  21808. if (var_obj.type == _types.Types.REAL) {
  21809. 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) + "' />");
  21810. input_field.insertBefore(parent_node.find('.span_value_variable'));
  21811. } else {
  21812. 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 + "' />");
  21813. input_field.insertBefore(parent_node.find('.span_value_variable'));
  21814. }
  21815. input_field.on('input', function () {
  21816. var inputWidth = input_field.textWidth() + 10;
  21817. opened_input_value_global_ar = input_field;
  21818. input_field.focus();
  21819. var tmpStr = input_field.val();
  21820. input_field.val('');
  21821. input_field.val(tmpStr);
  21822. input_field.css({
  21823. width: inputWidth
  21824. });
  21825. }).trigger('input');
  21826. input_field.focusout(function () {
  21827. /// update array:
  21828. if (input_field.val().trim()) {
  21829. if (var_obj.type == _types.Types.REAL) {
  21830. var_obj.value = parseFloat(input_field.val().trim());
  21831. parent_node.find('.span_value_variable').text(var_obj.value.toFixed(1));
  21832. } else {
  21833. if (var_obj.type == _types.Types.INTEGER) {
  21834. var_obj.value = parseInt(input_field.val().trim());
  21835. } else {
  21836. var_obj.value = input_field.val().trim();
  21837. }
  21838. parent_node.find('.span_value_variable').text(var_obj.value);
  21839. }
  21840. } else {
  21841. if (var_obj.type == _types.Types.REAL) {
  21842. parent_node.find('.span_value_variable').text(var_obj.value.toFixed(1));
  21843. } else {
  21844. parent_node.find('.span_value_variable').text(var_obj.value);
  21845. }
  21846. }
  21847. if (var_obj.type == _types.Types.TEXT) {
  21848. var_obj.value = input_field.val();
  21849. parent_node.find('.span_value_variable').text(var_obj.value);
  21850. }
  21851. input_field.off();
  21852. input_field.remove();
  21853. /// update elements:
  21854. opened_name_value_global_var = false;
  21855. opened_input_value_global_ar = false;
  21856. });
  21857. input_field.on('keydown', function (e) {
  21858. var code = e.keyCode || e.which;
  21859. if (code == 13) {
  21860. if (input_field.val().trim()) {
  21861. if (var_obj.type == _types.Types.REAL) {
  21862. var_obj.value = parseFloat(input_field.val().trim());
  21863. parent_node.find('.span_value_variable').text(var_obj.value.toFixed(1));
  21864. } else {
  21865. if (var_obj.type == _types.Types.INTEGER) {
  21866. var_obj.value = parseInt(input_field.val().trim());
  21867. } else {
  21868. var_obj.value = input_field.val().trim();
  21869. }
  21870. parent_node.find('.span_value_variable').text(var_obj.value);
  21871. }
  21872. } else {
  21873. if (var_obj.type == _types.Types.REAL) {
  21874. parent_node.find('.span_value_variable').text(var_obj.value.toFixed(1));
  21875. } else {
  21876. parent_node.find('.span_value_variable').text(var_obj.value);
  21877. }
  21878. }
  21879. if (var_obj.type == _types.Types.TEXT) {
  21880. var_obj.value = input_field.val();
  21881. parent_node.find('.span_value_variable').text(var_obj.value);
  21882. }
  21883. input_field.off();
  21884. input_field.remove();
  21885. /// update elements:
  21886. opened_name_value_global_var = false;
  21887. opened_input_value_global_ar = false;
  21888. }
  21889. if (code == 27) {
  21890. if (var_obj.type == _types.Types.REAL) {
  21891. parent_node.find('.span_value_variable').text(var_obj.value.toFixed(1));
  21892. } else {
  21893. parent_node.find('.span_value_variable').text(var_obj.value);
  21894. }
  21895. input_field.off();
  21896. input_field.remove();
  21897. /// update elements:
  21898. opened_name_value_global_var = false;
  21899. opened_input_value_global_ar = false;
  21900. }
  21901. });
  21902. input_field.select();
  21903. }
  21904. var opened_name_global = false;
  21905. var opened_input_global = null;
  21906. function enableNameUpdate(variable_obj, variable_container, function_obj) {
  21907. if (opened_name_global) {
  21908. opened_input_global.focus();
  21909. return;
  21910. }
  21911. opened_name_global = true;
  21912. variable_container.find('.span_name_variable').text('');
  21913. var input_name;
  21914. 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 + "' />");
  21915. input_name.insertBefore(variable_container.find('.span_name_variable'));
  21916. input_name.on('input', function () {
  21917. var inputWidth = input_name.textWidth() + 10;
  21918. opened_input_global = input_name;
  21919. input_name.focus();
  21920. var tmpStr = input_name.val();
  21921. input_name.val('');
  21922. input_name.val(tmpStr);
  21923. input_name.css({
  21924. width: inputWidth
  21925. });
  21926. }).trigger('input');
  21927. input_name.focusout(function () {
  21928. /// update array:
  21929. if (input_name.val().trim().length > 0) {
  21930. updateName(variable_obj, input_name.val().trim(), variable_container, function_obj);
  21931. variable_container.find('.span_name_variable').text(variable_obj.name);
  21932. } else {
  21933. variable_container.find('.span_name_variable').text(variable_obj.name);
  21934. }
  21935. input_name.off();
  21936. input_name.remove();
  21937. /// update elements:
  21938. opened_name_global = false;
  21939. opened_input_global = false;
  21940. });
  21941. input_name.on('keydown', function (e) {
  21942. var code = e.keyCode || e.which;
  21943. if (code == 13) {
  21944. if (input_name.val().trim().length > 0) {
  21945. updateName(variable_obj, input_name.val().trim(), variable_container, function_obj);
  21946. variable_container.find('.span_name_variable').text(variable_obj.name);
  21947. } else {
  21948. variable_container.find('.span_name_variable').text(variable_obj.name);
  21949. }
  21950. input_name.off();
  21951. input_name.remove();
  21952. /// update elements:
  21953. opened_name_global = false;
  21954. opened_input_global = false;
  21955. }
  21956. if (code == 27) {
  21957. variable_container.find('.span_name_variable').text(variable_obj.name);
  21958. input_name.off();
  21959. input_name.remove();
  21960. /// update elements:
  21961. opened_name_global = false;
  21962. opened_input_global = false;
  21963. }
  21964. });
  21965. input_name.select();
  21966. }
  21967. var opened_name_value_matrix_global_v = false;
  21968. var opened_input_value_matrix_global_v = null;
  21969. function enableMatrixValueUpdate(var_obj, row, index, parent_node) {
  21970. if (opened_name_value_matrix_global_v) {
  21971. opened_input_value_matrix_global_v.focus();
  21972. return;
  21973. }
  21974. parent_node = (0, _jquery2.default)(parent_node);
  21975. opened_name_value_matrix_global_v = true;
  21976. parent_node.find('.span_value_variable').text('');
  21977. var input_field;
  21978. if (var_obj.type == _types.Types.REAL) {
  21979. 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) + "' />");
  21980. input_field.insertBefore(parent_node.find('.span_value_variable'));
  21981. } else {
  21982. 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] + "' />");
  21983. input_field.insertBefore(parent_node.find('.span_value_variable'));
  21984. }
  21985. input_field.on('input', function () {
  21986. var inputWidth = input_field.textWidth() + 10;
  21987. opened_input_value_matrix_global_v = input_field;
  21988. input_field.focus();
  21989. var tmpStr = input_field.val();
  21990. input_field.val('');
  21991. input_field.val(tmpStr);
  21992. input_field.css({
  21993. width: inputWidth
  21994. });
  21995. }).trigger('input');
  21996. input_field.focusout(function () {
  21997. /// update array:
  21998. if (input_field.val().trim()) {
  21999. if (var_obj.type == _types.Types.REAL) {
  22000. var_obj.value[row][index] = parseFloat(input_field.val().trim());
  22001. parent_node.find('.span_value_variable').text(var_obj.value[row][index].toFixed(1));
  22002. } else {
  22003. if (var_obj.type == _types.Types.INTEGER) {
  22004. var_obj.value[row][index] = parseInt(input_field.val().trim());
  22005. } else {
  22006. var_obj.value[row][index] = input_field.val().trim();
  22007. }
  22008. parent_node.find('.span_value_variable').text(var_obj.value[row][index]);
  22009. }
  22010. } else {
  22011. if (var_obj.type == _types.Types.REAL) {
  22012. parent_node.find('.span_value_variable').text(var_obj.value[row][index].toFixed(1));
  22013. } else {
  22014. parent_node.find('.span_value_variable').text(var_obj.value[row][index]);
  22015. }
  22016. }
  22017. if (var_obj.type == _types.Types.TEXT) {
  22018. var_obj.value[row][index] = input_field.val();
  22019. parent_node.find('.span_value_variable').text(var_obj.value[row][index]);
  22020. }
  22021. input_field.off();
  22022. input_field.remove();
  22023. /// update elements:
  22024. opened_name_value_matrix_global_v = false;
  22025. opened_input_value_matrix_global_v = false;
  22026. });
  22027. input_field.on('keydown', function (e) {
  22028. var code = e.keyCode || e.which;
  22029. if (code == 13) {
  22030. if (input_field.val().trim()) {
  22031. if (var_obj.type == _types.Types.REAL) {
  22032. var_obj.value[row][index] = parseFloat(input_field.val().trim());
  22033. parent_node.find('.span_value_variable').text(var_obj.value[row][index].toFixed(1));
  22034. } else {
  22035. if (var_obj.type == _types.Types.INTEGER) {
  22036. var_obj.value[row][index] = parseInt(input_field.val().trim());
  22037. } else {
  22038. var_obj.value[row][index] = input_field.val().trim();
  22039. }
  22040. parent_node.find('.span_value_variable').text(var_obj.value[row][index]);
  22041. }
  22042. } else {
  22043. if (var_obj.type == _types.Types.REAL) {
  22044. parent_node.find('.span_value_variable').text(var_obj.value[row][index].toFixed(1));
  22045. } else {
  22046. parent_node.find('.span_value_variable').text(var_obj.value[row][index]);
  22047. }
  22048. }
  22049. if (var_obj.type == _types.Types.TEXT) {
  22050. var_obj.value[row][index] = input_field.val();
  22051. parent_node.find('.span_value_variable').text(var_obj.value[row][index]);
  22052. }
  22053. input_field.off();
  22054. input_field.remove();
  22055. /// update elements:
  22056. opened_name_value_matrix_global_v = false;
  22057. opened_input_value_matrix_global_v = false;
  22058. }
  22059. if (code == 27) {
  22060. if (var_obj.type == _types.Types.REAL) {
  22061. parent_node.find('.span_value_variable').text(var_obj.value[row][index].toFixed(1));
  22062. } else {
  22063. parent_node.find('.span_value_variable').text(var_obj.value[row][index]);
  22064. }
  22065. input_field.off();
  22066. input_field.remove();
  22067. /// update elements:
  22068. opened_name_value_matrix_global_v = false;
  22069. opened_input_value_matrix_global_v = false;
  22070. }
  22071. });
  22072. input_field.select();
  22073. }
  22074. /***/ }),
  22075. /***/ "./node_modules/antlr4/BufferedTokenStream.js":
  22076. /*!****************************************************!*\
  22077. !*** ./node_modules/antlr4/BufferedTokenStream.js ***!
  22078. \****************************************************/
  22079. /*! no static exports found */
  22080. /***/ (function(module, exports, __webpack_require__) {
  22081. "use strict";
  22082. //
  22083. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  22084. * Use of this file is governed by the BSD 3-clause license that
  22085. * can be found in the LICENSE.txt file in the project root.
  22086. */
  22087. // This implementation of {@link TokenStream} loads tokens from a
  22088. // {@link TokenSource} on-demand, and places the tokens in a buffer to provide
  22089. // access to any previous token by index.
  22090. //
  22091. // <p>
  22092. // This token stream ignores the value of {@link Token//getChannel}. If your
  22093. // parser requires the token stream filter tokens to only those on a particular
  22094. // channel, such as {@link Token//DEFAULT_CHANNEL} or
  22095. // {@link Token//HIDDEN_CHANNEL}, use a filtering token stream such a
  22096. // {@link CommonTokenStream}.</p>
  22097. var Token = __webpack_require__(/*! ./Token */ "./node_modules/antlr4/Token.js").Token;
  22098. var Lexer = __webpack_require__(/*! ./Lexer */ "./node_modules/antlr4/Lexer.js").Lexer;
  22099. var Interval = __webpack_require__(/*! ./IntervalSet */ "./node_modules/antlr4/IntervalSet.js").Interval;
  22100. // this is just to keep meaningful parameter types to Parser
  22101. function TokenStream() {
  22102. return this;
  22103. }
  22104. function BufferedTokenStream(tokenSource) {
  22105. TokenStream.call(this);
  22106. // The {@link TokenSource} from which tokens for this stream are fetched.
  22107. this.tokenSource = tokenSource;
  22108. // A collection of all tokens fetched from the token source. The list is
  22109. // considered a complete view of the input once {@link //fetchedEOF} is set
  22110. // to {@code true}.
  22111. this.tokens = [];
  22112. // The index into {@link //tokens} of the current token (next token to
  22113. // {@link //consume}). {@link //tokens}{@code [}{@link //p}{@code ]} should
  22114. // be
  22115. // {@link //LT LT(1)}.
  22116. //
  22117. // <p>This field is set to -1 when the stream is first constructed or when
  22118. // {@link //setTokenSource} is called, indicating that the first token has
  22119. // not yet been fetched from the token source. For additional information,
  22120. // see the documentation of {@link IntStream} for a description of
  22121. // Initializing Methods.</p>
  22122. this.index = -1;
  22123. // Indicates whether the {@link Token//EOF} token has been fetched from
  22124. // {@link //tokenSource} and added to {@link //tokens}. This field improves
  22125. // performance for the following cases:
  22126. //
  22127. // <ul>
  22128. // <li>{@link //consume}: The lookahead check in {@link //consume} to
  22129. // prevent
  22130. // consuming the EOF symbol is optimized by checking the values of
  22131. // {@link //fetchedEOF} and {@link //p} instead of calling {@link
  22132. // //LA}.</li>
  22133. // <li>{@link //fetch}: The check to prevent adding multiple EOF symbols
  22134. // into
  22135. // {@link //tokens} is trivial with this field.</li>
  22136. // <ul>
  22137. this.fetchedEOF = false;
  22138. return this;
  22139. }
  22140. BufferedTokenStream.prototype = Object.create(TokenStream.prototype);
  22141. BufferedTokenStream.prototype.constructor = BufferedTokenStream;
  22142. BufferedTokenStream.prototype.mark = function () {
  22143. return 0;
  22144. };
  22145. BufferedTokenStream.prototype.release = function (marker) {
  22146. // no resources to release
  22147. };
  22148. BufferedTokenStream.prototype.reset = function () {
  22149. this.seek(0);
  22150. };
  22151. BufferedTokenStream.prototype.seek = function (index) {
  22152. this.lazyInit();
  22153. this.index = this.adjustSeekIndex(index);
  22154. };
  22155. BufferedTokenStream.prototype.get = function (index) {
  22156. this.lazyInit();
  22157. return this.tokens[index];
  22158. };
  22159. BufferedTokenStream.prototype.consume = function () {
  22160. var skipEofCheck = false;
  22161. if (this.index >= 0) {
  22162. if (this.fetchedEOF) {
  22163. // the last token in tokens is EOF. skip check if p indexes any
  22164. // fetched token except the last.
  22165. skipEofCheck = this.index < this.tokens.length - 1;
  22166. } else {
  22167. // no EOF token in tokens. skip check if p indexes a fetched token.
  22168. skipEofCheck = this.index < this.tokens.length;
  22169. }
  22170. } else {
  22171. // not yet initialized
  22172. skipEofCheck = false;
  22173. }
  22174. if (!skipEofCheck && this.LA(1) === Token.EOF) {
  22175. throw "cannot consume EOF";
  22176. }
  22177. if (this.sync(this.index + 1)) {
  22178. this.index = this.adjustSeekIndex(this.index + 1);
  22179. }
  22180. };
  22181. // Make sure index {@code i} in tokens has a token.
  22182. //
  22183. // @return {@code true} if a token is located at index {@code i}, otherwise
  22184. // {@code false}.
  22185. // @see //get(int i)
  22186. // /
  22187. BufferedTokenStream.prototype.sync = function (i) {
  22188. var n = i - this.tokens.length + 1; // how many more elements we need?
  22189. if (n > 0) {
  22190. var fetched = this.fetch(n);
  22191. return fetched >= n;
  22192. }
  22193. return true;
  22194. };
  22195. // Add {@code n} elements to buffer.
  22196. //
  22197. // @return The actual number of elements added to the buffer.
  22198. // /
  22199. BufferedTokenStream.prototype.fetch = function (n) {
  22200. if (this.fetchedEOF) {
  22201. return 0;
  22202. }
  22203. for (var i = 0; i < n; i++) {
  22204. var t = this.tokenSource.nextToken();
  22205. t.tokenIndex = this.tokens.length;
  22206. this.tokens.push(t);
  22207. if (t.type === Token.EOF) {
  22208. this.fetchedEOF = true;
  22209. return i + 1;
  22210. }
  22211. }
  22212. return n;
  22213. };
  22214. // Get all tokens from start..stop inclusively///
  22215. BufferedTokenStream.prototype.getTokens = function (start, stop, types) {
  22216. if (types === undefined) {
  22217. types = null;
  22218. }
  22219. if (start < 0 || stop < 0) {
  22220. return null;
  22221. }
  22222. this.lazyInit();
  22223. var subset = [];
  22224. if (stop >= this.tokens.length) {
  22225. stop = this.tokens.length - 1;
  22226. }
  22227. for (var i = start; i < stop; i++) {
  22228. var t = this.tokens[i];
  22229. if (t.type === Token.EOF) {
  22230. break;
  22231. }
  22232. if (types === null || types.contains(t.type)) {
  22233. subset.push(t);
  22234. }
  22235. }
  22236. return subset;
  22237. };
  22238. BufferedTokenStream.prototype.LA = function (i) {
  22239. return this.LT(i).type;
  22240. };
  22241. BufferedTokenStream.prototype.LB = function (k) {
  22242. if (this.index - k < 0) {
  22243. return null;
  22244. }
  22245. return this.tokens[this.index - k];
  22246. };
  22247. BufferedTokenStream.prototype.LT = function (k) {
  22248. this.lazyInit();
  22249. if (k === 0) {
  22250. return null;
  22251. }
  22252. if (k < 0) {
  22253. return this.LB(-k);
  22254. }
  22255. var i = this.index + k - 1;
  22256. this.sync(i);
  22257. if (i >= this.tokens.length) {
  22258. // return EOF token
  22259. // EOF must be last token
  22260. return this.tokens[this.tokens.length - 1];
  22261. }
  22262. return this.tokens[i];
  22263. };
  22264. // Allowed derived classes to modify the behavior of operations which change
  22265. // the current stream position by adjusting the target token index of a seek
  22266. // operation. The default implementation simply returns {@code i}. If an
  22267. // exception is thrown in this method, the current stream index should not be
  22268. // changed.
  22269. //
  22270. // <p>For example, {@link CommonTokenStream} overrides this method to ensure
  22271. // that
  22272. // the seek target is always an on-channel token.</p>
  22273. //
  22274. // @param i The target token index.
  22275. // @return The adjusted target token index.
  22276. BufferedTokenStream.prototype.adjustSeekIndex = function (i) {
  22277. return i;
  22278. };
  22279. BufferedTokenStream.prototype.lazyInit = function () {
  22280. if (this.index === -1) {
  22281. this.setup();
  22282. }
  22283. };
  22284. BufferedTokenStream.prototype.setup = function () {
  22285. this.sync(0);
  22286. this.index = this.adjustSeekIndex(0);
  22287. };
  22288. // Reset this token stream by setting its token source.///
  22289. BufferedTokenStream.prototype.setTokenSource = function (tokenSource) {
  22290. this.tokenSource = tokenSource;
  22291. this.tokens = [];
  22292. this.index = -1;
  22293. this.fetchedEOF = false;
  22294. };
  22295. // Given a starting index, return the index of the next token on channel.
  22296. // Return i if tokens[i] is on channel. Return -1 if there are no tokens
  22297. // on channel between i and EOF.
  22298. // /
  22299. BufferedTokenStream.prototype.nextTokenOnChannel = function (i, channel) {
  22300. this.sync(i);
  22301. if (i >= this.tokens.length) {
  22302. return -1;
  22303. }
  22304. var token = this.tokens[i];
  22305. while (token.channel !== this.channel) {
  22306. if (token.type === Token.EOF) {
  22307. return -1;
  22308. }
  22309. i += 1;
  22310. this.sync(i);
  22311. token = this.tokens[i];
  22312. }
  22313. return i;
  22314. };
  22315. // Given a starting index, return the index of the previous token on channel.
  22316. // Return i if tokens[i] is on channel. Return -1 if there are no tokens
  22317. // on channel between i and 0.
  22318. BufferedTokenStream.prototype.previousTokenOnChannel = function (i, channel) {
  22319. while (i >= 0 && this.tokens[i].channel !== channel) {
  22320. i -= 1;
  22321. }
  22322. return i;
  22323. };
  22324. // Collect all tokens on specified channel to the right of
  22325. // the current token up until we see a token on DEFAULT_TOKEN_CHANNEL or
  22326. // EOF. If channel is -1, find any non default channel token.
  22327. BufferedTokenStream.prototype.getHiddenTokensToRight = function (tokenIndex, channel) {
  22328. if (channel === undefined) {
  22329. channel = -1;
  22330. }
  22331. this.lazyInit();
  22332. if (tokenIndex < 0 || tokenIndex >= this.tokens.length) {
  22333. throw "" + tokenIndex + " not in 0.." + this.tokens.length - 1;
  22334. }
  22335. var nextOnChannel = this.nextTokenOnChannel(tokenIndex + 1, Lexer.DEFAULT_TOKEN_CHANNEL);
  22336. var from_ = tokenIndex + 1;
  22337. // if none onchannel to right, nextOnChannel=-1 so set to = last token
  22338. var to = nextOnChannel === -1 ? this.tokens.length - 1 : nextOnChannel;
  22339. return this.filterForChannel(from_, to, channel);
  22340. };
  22341. // Collect all tokens on specified channel to the left of
  22342. // the current token up until we see a token on DEFAULT_TOKEN_CHANNEL.
  22343. // If channel is -1, find any non default channel token.
  22344. BufferedTokenStream.prototype.getHiddenTokensToLeft = function (tokenIndex, channel) {
  22345. if (channel === undefined) {
  22346. channel = -1;
  22347. }
  22348. this.lazyInit();
  22349. if (tokenIndex < 0 || tokenIndex >= this.tokens.length) {
  22350. throw "" + tokenIndex + " not in 0.." + this.tokens.length - 1;
  22351. }
  22352. var prevOnChannel = this.previousTokenOnChannel(tokenIndex - 1, Lexer.DEFAULT_TOKEN_CHANNEL);
  22353. if (prevOnChannel === tokenIndex - 1) {
  22354. return null;
  22355. }
  22356. // if none on channel to left, prevOnChannel=-1 then from=0
  22357. var from_ = prevOnChannel + 1;
  22358. var to = tokenIndex - 1;
  22359. return this.filterForChannel(from_, to, channel);
  22360. };
  22361. BufferedTokenStream.prototype.filterForChannel = function (left, right, channel) {
  22362. var hidden = [];
  22363. for (var i = left; i < right + 1; i++) {
  22364. var t = this.tokens[i];
  22365. if (channel === -1) {
  22366. if (t.channel !== Lexer.DEFAULT_TOKEN_CHANNEL) {
  22367. hidden.push(t);
  22368. }
  22369. } else if (t.channel === channel) {
  22370. hidden.push(t);
  22371. }
  22372. }
  22373. if (hidden.length === 0) {
  22374. return null;
  22375. }
  22376. return hidden;
  22377. };
  22378. BufferedTokenStream.prototype.getSourceName = function () {
  22379. return this.tokenSource.getSourceName();
  22380. };
  22381. // Get the text of all tokens in this buffer.///
  22382. BufferedTokenStream.prototype.getText = function (interval) {
  22383. this.lazyInit();
  22384. this.fill();
  22385. if (interval === undefined || interval === null) {
  22386. interval = new Interval(0, this.tokens.length - 1);
  22387. }
  22388. var start = interval.start;
  22389. if (start instanceof Token) {
  22390. start = start.tokenIndex;
  22391. }
  22392. var stop = interval.stop;
  22393. if (stop instanceof Token) {
  22394. stop = stop.tokenIndex;
  22395. }
  22396. if (start === null || stop === null || start < 0 || stop < 0) {
  22397. return "";
  22398. }
  22399. if (stop >= this.tokens.length) {
  22400. stop = this.tokens.length - 1;
  22401. }
  22402. var s = "";
  22403. for (var i = start; i < stop + 1; i++) {
  22404. var t = this.tokens[i];
  22405. if (t.type === Token.EOF) {
  22406. break;
  22407. }
  22408. s = s + t.text;
  22409. }
  22410. return s;
  22411. };
  22412. // Get all tokens from lexer until EOF///
  22413. BufferedTokenStream.prototype.fill = function () {
  22414. this.lazyInit();
  22415. while (this.fetch(1000) === 1000) {
  22416. continue;
  22417. }
  22418. };
  22419. exports.BufferedTokenStream = BufferedTokenStream;
  22420. /***/ }),
  22421. /***/ "./node_modules/antlr4/CharStreams.js":
  22422. /*!********************************************!*\
  22423. !*** ./node_modules/antlr4/CharStreams.js ***!
  22424. \********************************************/
  22425. /*! no static exports found */
  22426. /***/ (function(module, exports, __webpack_require__) {
  22427. "use strict";
  22428. //
  22429. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  22430. * Use of this file is governed by the BSD 3-clause license that
  22431. * can be found in the LICENSE.txt file in the project root.
  22432. */
  22433. //
  22434. var InputStream = __webpack_require__(/*! ./InputStream */ "./node_modules/antlr4/InputStream.js").InputStream;
  22435. var isNodeJs = typeof window === 'undefined' && typeof importScripts === 'undefined';
  22436. var fs = isNodeJs ? __webpack_require__(/*! fs */ "./node_modules/node-libs-browser/mock/empty.js") : null;
  22437. // Utility functions to create InputStreams from various sources.
  22438. //
  22439. // All returned InputStreams support the full range of Unicode
  22440. // up to U+10FFFF (the default behavior of InputStream only supports
  22441. // code points up to U+FFFF).
  22442. var CharStreams = {
  22443. // Creates an InputStream from a string.
  22444. fromString: function fromString(str) {
  22445. return new InputStream(str, true);
  22446. },
  22447. // Asynchronously creates an InputStream from a blob given the
  22448. // encoding of the bytes in that blob (defaults to 'utf8' if
  22449. // encoding is null).
  22450. //
  22451. // Invokes onLoad(result) on success, onError(error) on
  22452. // failure.
  22453. fromBlob: function fromBlob(blob, encoding, onLoad, onError) {
  22454. var reader = FileReader();
  22455. reader.onload = function (e) {
  22456. var is = new InputStream(e.target.result, true);
  22457. onLoad(is);
  22458. };
  22459. reader.onerror = onError;
  22460. reader.readAsText(blob, encoding);
  22461. },
  22462. // Creates an InputStream from a Buffer given the
  22463. // encoding of the bytes in that buffer (defaults to 'utf8' if
  22464. // encoding is null).
  22465. fromBuffer: function fromBuffer(buffer, encoding) {
  22466. return new InputStream(buffer.toString(encoding), true);
  22467. },
  22468. // Asynchronously creates an InputStream from a file on disk given
  22469. // the encoding of the bytes in that file (defaults to 'utf8' if
  22470. // encoding is null).
  22471. //
  22472. // Invokes callback(error, result) on completion.
  22473. fromPath: function fromPath(path, encoding, callback) {
  22474. fs.readFile(path, encoding, function (err, data) {
  22475. var is = null;
  22476. if (data !== null) {
  22477. is = new InputStream(data, true);
  22478. }
  22479. callback(err, is);
  22480. });
  22481. },
  22482. // Synchronously creates an InputStream given a path to a file
  22483. // on disk and the encoding of the bytes in that file (defaults to
  22484. // 'utf8' if encoding is null).
  22485. fromPathSync: function fromPathSync(path, encoding) {
  22486. var data = fs.readFileSync(path, encoding);
  22487. return new InputStream(data, true);
  22488. }
  22489. };
  22490. exports.CharStreams = CharStreams;
  22491. /***/ }),
  22492. /***/ "./node_modules/antlr4/CommonTokenFactory.js":
  22493. /*!***************************************************!*\
  22494. !*** ./node_modules/antlr4/CommonTokenFactory.js ***!
  22495. \***************************************************/
  22496. /*! no static exports found */
  22497. /***/ (function(module, exports, __webpack_require__) {
  22498. "use strict";
  22499. //
  22500. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  22501. * Use of this file is governed by the BSD 3-clause license that
  22502. * can be found in the LICENSE.txt file in the project root.
  22503. */
  22504. //
  22505. //
  22506. // This default implementation of {@link TokenFactory} creates
  22507. // {@link CommonToken} objects.
  22508. //
  22509. var CommonToken = __webpack_require__(/*! ./Token */ "./node_modules/antlr4/Token.js").CommonToken;
  22510. function TokenFactory() {
  22511. return this;
  22512. }
  22513. function CommonTokenFactory(copyText) {
  22514. TokenFactory.call(this);
  22515. // Indicates whether {@link CommonToken//setText} should be called after
  22516. // constructing tokens to explicitly set the text. This is useful for cases
  22517. // where the input stream might not be able to provide arbitrary substrings
  22518. // of text from the input after the lexer creates a token (e.g. the
  22519. // implementation of {@link CharStream//getText} in
  22520. // {@link UnbufferedCharStream} throws an
  22521. // {@link UnsupportedOperationException}). Explicitly setting the token text
  22522. // allows {@link Token//getText} to be called at any time regardless of the
  22523. // input stream implementation.
  22524. //
  22525. // <p>
  22526. // The default value is {@code false} to avoid the performance and memory
  22527. // overhead of copying text for every token unless explicitly requested.</p>
  22528. //
  22529. this.copyText = copyText === undefined ? false : copyText;
  22530. return this;
  22531. }
  22532. CommonTokenFactory.prototype = Object.create(TokenFactory.prototype);
  22533. CommonTokenFactory.prototype.constructor = CommonTokenFactory;
  22534. //
  22535. // The default {@link CommonTokenFactory} instance.
  22536. //
  22537. // <p>
  22538. // This token factory does not explicitly copy token text when constructing
  22539. // tokens.</p>
  22540. //
  22541. CommonTokenFactory.DEFAULT = new CommonTokenFactory();
  22542. CommonTokenFactory.prototype.create = function (source, type, text, channel, start, stop, line, column) {
  22543. var t = new CommonToken(source, type, channel, start, stop);
  22544. t.line = line;
  22545. t.column = column;
  22546. if (text !== null) {
  22547. t.text = text;
  22548. } else if (this.copyText && source[1] !== null) {
  22549. t.text = source[1].getText(start, stop);
  22550. }
  22551. return t;
  22552. };
  22553. CommonTokenFactory.prototype.createThin = function (type, text) {
  22554. var t = new CommonToken(null, type);
  22555. t.text = text;
  22556. return t;
  22557. };
  22558. exports.CommonTokenFactory = CommonTokenFactory;
  22559. /***/ }),
  22560. /***/ "./node_modules/antlr4/CommonTokenStream.js":
  22561. /*!**************************************************!*\
  22562. !*** ./node_modules/antlr4/CommonTokenStream.js ***!
  22563. \**************************************************/
  22564. /*! no static exports found */
  22565. /***/ (function(module, exports, __webpack_require__) {
  22566. "use strict";
  22567. //
  22568. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  22569. * Use of this file is governed by the BSD 3-clause license that
  22570. * can be found in the LICENSE.txt file in the project root.
  22571. */
  22572. ///
  22573. //
  22574. // This class extends {@link BufferedTokenStream} with functionality to filter
  22575. // token streams to tokens on a particular channel (tokens where
  22576. // {@link Token//getChannel} returns a particular value).
  22577. //
  22578. // <p>
  22579. // This token stream provides access to all tokens by index or when calling
  22580. // methods like {@link //getText}. The channel filtering is only used for code
  22581. // accessing tokens via the lookahead methods {@link //LA}, {@link //LT}, and
  22582. // {@link //LB}.</p>
  22583. //
  22584. // <p>
  22585. // By default, tokens are placed on the default channel
  22586. // ({@link Token//DEFAULT_CHANNEL}), but may be reassigned by using the
  22587. // {@code ->channel(HIDDEN)} lexer command, or by using an embedded action to
  22588. // call {@link Lexer//setChannel}.
  22589. // </p>
  22590. //
  22591. // <p>
  22592. // Note: lexer rules which use the {@code ->skip} lexer command or call
  22593. // {@link Lexer//skip} do not produce tokens at all, so input text matched by
  22594. // such a rule will not be available as part of the token stream, regardless of
  22595. // channel.</p>
  22596. ///
  22597. var Token = __webpack_require__(/*! ./Token */ "./node_modules/antlr4/Token.js").Token;
  22598. var BufferedTokenStream = __webpack_require__(/*! ./BufferedTokenStream */ "./node_modules/antlr4/BufferedTokenStream.js").BufferedTokenStream;
  22599. function CommonTokenStream(lexer, channel) {
  22600. BufferedTokenStream.call(this, lexer);
  22601. this.channel = channel === undefined ? Token.DEFAULT_CHANNEL : channel;
  22602. return this;
  22603. }
  22604. CommonTokenStream.prototype = Object.create(BufferedTokenStream.prototype);
  22605. CommonTokenStream.prototype.constructor = CommonTokenStream;
  22606. CommonTokenStream.prototype.adjustSeekIndex = function (i) {
  22607. return this.nextTokenOnChannel(i, this.channel);
  22608. };
  22609. CommonTokenStream.prototype.LB = function (k) {
  22610. if (k === 0 || this.index - k < 0) {
  22611. return null;
  22612. }
  22613. var i = this.index;
  22614. var n = 1;
  22615. // find k good tokens looking backwards
  22616. while (n <= k) {
  22617. // skip off-channel tokens
  22618. i = this.previousTokenOnChannel(i - 1, this.channel);
  22619. n += 1;
  22620. }
  22621. if (i < 0) {
  22622. return null;
  22623. }
  22624. return this.tokens[i];
  22625. };
  22626. CommonTokenStream.prototype.LT = function (k) {
  22627. this.lazyInit();
  22628. if (k === 0) {
  22629. return null;
  22630. }
  22631. if (k < 0) {
  22632. return this.LB(-k);
  22633. }
  22634. var i = this.index;
  22635. var n = 1; // we know tokens[pos] is a good one
  22636. // find k good tokens
  22637. while (n < k) {
  22638. // skip off-channel tokens, but make sure to not look past EOF
  22639. if (this.sync(i + 1)) {
  22640. i = this.nextTokenOnChannel(i + 1, this.channel);
  22641. }
  22642. n += 1;
  22643. }
  22644. return this.tokens[i];
  22645. };
  22646. // Count EOF just once.///
  22647. CommonTokenStream.prototype.getNumberOfOnChannelTokens = function () {
  22648. var n = 0;
  22649. this.fill();
  22650. for (var i = 0; i < this.tokens.length; i++) {
  22651. var t = this.tokens[i];
  22652. if (t.channel === this.channel) {
  22653. n += 1;
  22654. }
  22655. if (t.type === Token.EOF) {
  22656. break;
  22657. }
  22658. }
  22659. return n;
  22660. };
  22661. exports.CommonTokenStream = CommonTokenStream;
  22662. /***/ }),
  22663. /***/ "./node_modules/antlr4/FileStream.js":
  22664. /*!*******************************************!*\
  22665. !*** ./node_modules/antlr4/FileStream.js ***!
  22666. \*******************************************/
  22667. /*! no static exports found */
  22668. /***/ (function(module, exports, __webpack_require__) {
  22669. "use strict";
  22670. //
  22671. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  22672. * Use of this file is governed by the BSD 3-clause license that
  22673. * can be found in the LICENSE.txt file in the project root.
  22674. */
  22675. //
  22676. //
  22677. // This is an InputStream that is loaded from a file all at once
  22678. // when you construct the object.
  22679. //
  22680. var InputStream = __webpack_require__(/*! ./InputStream */ "./node_modules/antlr4/InputStream.js").InputStream;
  22681. var isNodeJs = typeof window === 'undefined' && typeof importScripts === 'undefined';
  22682. var fs = isNodeJs ? __webpack_require__(/*! fs */ "./node_modules/node-libs-browser/mock/empty.js") : null;
  22683. function FileStream(fileName, decodeToUnicodeCodePoints) {
  22684. var data = fs.readFileSync(fileName, "utf8");
  22685. InputStream.call(this, data, decodeToUnicodeCodePoints);
  22686. this.fileName = fileName;
  22687. return this;
  22688. }
  22689. FileStream.prototype = Object.create(InputStream.prototype);
  22690. FileStream.prototype.constructor = FileStream;
  22691. exports.FileStream = FileStream;
  22692. /***/ }),
  22693. /***/ "./node_modules/antlr4/InputStream.js":
  22694. /*!********************************************!*\
  22695. !*** ./node_modules/antlr4/InputStream.js ***!
  22696. \********************************************/
  22697. /*! no static exports found */
  22698. /***/ (function(module, exports, __webpack_require__) {
  22699. "use strict";
  22700. //
  22701. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  22702. * Use of this file is governed by the BSD 3-clause license that
  22703. * can be found in the LICENSE.txt file in the project root.
  22704. */
  22705. //
  22706. var Token = __webpack_require__(/*! ./Token */ "./node_modules/antlr4/Token.js").Token;
  22707. __webpack_require__(/*! ./polyfills/codepointat */ "./node_modules/antlr4/polyfills/codepointat.js");
  22708. __webpack_require__(/*! ./polyfills/fromcodepoint */ "./node_modules/antlr4/polyfills/fromcodepoint.js");
  22709. // Vacuum all input from a string and then treat it like a buffer.
  22710. function _loadString(stream, decodeToUnicodeCodePoints) {
  22711. stream._index = 0;
  22712. stream.data = [];
  22713. if (stream.decodeToUnicodeCodePoints) {
  22714. for (var i = 0; i < stream.strdata.length;) {
  22715. var codePoint = stream.strdata.codePointAt(i);
  22716. stream.data.push(codePoint);
  22717. i += codePoint <= 0xFFFF ? 1 : 2;
  22718. }
  22719. } else {
  22720. for (var i = 0; i < stream.strdata.length; i++) {
  22721. var codeUnit = stream.strdata.charCodeAt(i);
  22722. stream.data.push(codeUnit);
  22723. }
  22724. }
  22725. stream._size = stream.data.length;
  22726. }
  22727. // If decodeToUnicodeCodePoints is true, the input is treated
  22728. // as a series of Unicode code points.
  22729. //
  22730. // Otherwise, the input is treated as a series of 16-bit UTF-16 code
  22731. // units.
  22732. function InputStream(data, decodeToUnicodeCodePoints) {
  22733. this.name = "<empty>";
  22734. this.strdata = data;
  22735. this.decodeToUnicodeCodePoints = decodeToUnicodeCodePoints || false;
  22736. _loadString(this);
  22737. return this;
  22738. }
  22739. Object.defineProperty(InputStream.prototype, "index", {
  22740. get: function get() {
  22741. return this._index;
  22742. }
  22743. });
  22744. Object.defineProperty(InputStream.prototype, "size", {
  22745. get: function get() {
  22746. return this._size;
  22747. }
  22748. });
  22749. // Reset the stream so that it's in the same state it was
  22750. // when the object was created *except* the data array is not
  22751. // touched.
  22752. //
  22753. InputStream.prototype.reset = function () {
  22754. this._index = 0;
  22755. };
  22756. InputStream.prototype.consume = function () {
  22757. if (this._index >= this._size) {
  22758. // assert this.LA(1) == Token.EOF
  22759. throw "cannot consume EOF";
  22760. }
  22761. this._index += 1;
  22762. };
  22763. InputStream.prototype.LA = function (offset) {
  22764. if (offset === 0) {
  22765. return 0; // undefined
  22766. }
  22767. if (offset < 0) {
  22768. offset += 1; // e.g., translate LA(-1) to use offset=0
  22769. }
  22770. var pos = this._index + offset - 1;
  22771. if (pos < 0 || pos >= this._size) {
  22772. // invalid
  22773. return Token.EOF;
  22774. }
  22775. return this.data[pos];
  22776. };
  22777. InputStream.prototype.LT = function (offset) {
  22778. return this.LA(offset);
  22779. };
  22780. // mark/release do nothing; we have entire buffer
  22781. InputStream.prototype.mark = function () {
  22782. return -1;
  22783. };
  22784. InputStream.prototype.release = function (marker) {};
  22785. // consume() ahead until p==_index; can't just set p=_index as we must
  22786. // update line and column. If we seek backwards, just set p
  22787. //
  22788. InputStream.prototype.seek = function (_index) {
  22789. if (_index <= this._index) {
  22790. this._index = _index; // just jump; don't update stream state (line,
  22791. // ...)
  22792. return;
  22793. }
  22794. // seek forward
  22795. this._index = Math.min(_index, this._size);
  22796. };
  22797. InputStream.prototype.getText = function (start, stop) {
  22798. if (stop >= this._size) {
  22799. stop = this._size - 1;
  22800. }
  22801. if (start >= this._size) {
  22802. return "";
  22803. } else {
  22804. if (this.decodeToUnicodeCodePoints) {
  22805. var result = "";
  22806. for (var i = start; i <= stop; i++) {
  22807. result += String.fromCodePoint(this.data[i]);
  22808. }
  22809. return result;
  22810. } else {
  22811. return this.strdata.slice(start, stop + 1);
  22812. }
  22813. }
  22814. };
  22815. InputStream.prototype.toString = function () {
  22816. return this.strdata;
  22817. };
  22818. exports.InputStream = InputStream;
  22819. /***/ }),
  22820. /***/ "./node_modules/antlr4/IntervalSet.js":
  22821. /*!********************************************!*\
  22822. !*** ./node_modules/antlr4/IntervalSet.js ***!
  22823. \********************************************/
  22824. /*! no static exports found */
  22825. /***/ (function(module, exports, __webpack_require__) {
  22826. "use strict";
  22827. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  22828. * Use of this file is governed by the BSD 3-clause license that
  22829. * can be found in the LICENSE.txt file in the project root.
  22830. */
  22831. /*jslint smarttabs:true */
  22832. var Token = __webpack_require__(/*! ./Token */ "./node_modules/antlr4/Token.js").Token;
  22833. /* stop is not included! */
  22834. function Interval(start, stop) {
  22835. this.start = start;
  22836. this.stop = stop;
  22837. return this;
  22838. }
  22839. Interval.prototype.contains = function (item) {
  22840. return item >= this.start && item < this.stop;
  22841. };
  22842. Interval.prototype.toString = function () {
  22843. if (this.start === this.stop - 1) {
  22844. return this.start.toString();
  22845. } else {
  22846. return this.start.toString() + ".." + (this.stop - 1).toString();
  22847. }
  22848. };
  22849. Object.defineProperty(Interval.prototype, "length", {
  22850. get: function get() {
  22851. return this.stop - this.start;
  22852. }
  22853. });
  22854. function IntervalSet() {
  22855. this.intervals = null;
  22856. this.readOnly = false;
  22857. }
  22858. IntervalSet.prototype.first = function (v) {
  22859. if (this.intervals === null || this.intervals.length === 0) {
  22860. return Token.INVALID_TYPE;
  22861. } else {
  22862. return this.intervals[0].start;
  22863. }
  22864. };
  22865. IntervalSet.prototype.addOne = function (v) {
  22866. this.addInterval(new Interval(v, v + 1));
  22867. };
  22868. IntervalSet.prototype.addRange = function (l, h) {
  22869. this.addInterval(new Interval(l, h + 1));
  22870. };
  22871. IntervalSet.prototype.addInterval = function (v) {
  22872. if (this.intervals === null) {
  22873. this.intervals = [];
  22874. this.intervals.push(v);
  22875. } else {
  22876. // find insert pos
  22877. for (var k = 0; k < this.intervals.length; k++) {
  22878. var i = this.intervals[k];
  22879. // distinct range -> insert
  22880. if (v.stop < i.start) {
  22881. this.intervals.splice(k, 0, v);
  22882. return;
  22883. }
  22884. // contiguous range -> adjust
  22885. else if (v.stop === i.start) {
  22886. this.intervals[k].start = v.start;
  22887. return;
  22888. }
  22889. // overlapping range -> adjust and reduce
  22890. else if (v.start <= i.stop) {
  22891. this.intervals[k] = new Interval(Math.min(i.start, v.start), Math.max(i.stop, v.stop));
  22892. this.reduce(k);
  22893. return;
  22894. }
  22895. }
  22896. // greater than any existing
  22897. this.intervals.push(v);
  22898. }
  22899. };
  22900. IntervalSet.prototype.addSet = function (other) {
  22901. if (other.intervals !== null) {
  22902. for (var k = 0; k < other.intervals.length; k++) {
  22903. var i = other.intervals[k];
  22904. this.addInterval(new Interval(i.start, i.stop));
  22905. }
  22906. }
  22907. return this;
  22908. };
  22909. IntervalSet.prototype.reduce = function (k) {
  22910. // only need to reduce if k is not the last
  22911. if (k < this.intervalslength - 1) {
  22912. var l = this.intervals[k];
  22913. var r = this.intervals[k + 1];
  22914. // if r contained in l
  22915. if (l.stop >= r.stop) {
  22916. this.intervals.pop(k + 1);
  22917. this.reduce(k);
  22918. } else if (l.stop >= r.start) {
  22919. this.intervals[k] = new Interval(l.start, r.stop);
  22920. this.intervals.pop(k + 1);
  22921. }
  22922. }
  22923. };
  22924. IntervalSet.prototype.complement = function (start, stop) {
  22925. var result = new IntervalSet();
  22926. result.addInterval(new Interval(start, stop + 1));
  22927. for (var i = 0; i < this.intervals.length; i++) {
  22928. result.removeRange(this.intervals[i]);
  22929. }
  22930. return result;
  22931. };
  22932. IntervalSet.prototype.contains = function (item) {
  22933. if (this.intervals === null) {
  22934. return false;
  22935. } else {
  22936. for (var k = 0; k < this.intervals.length; k++) {
  22937. if (this.intervals[k].contains(item)) {
  22938. return true;
  22939. }
  22940. }
  22941. return false;
  22942. }
  22943. };
  22944. Object.defineProperty(IntervalSet.prototype, "length", {
  22945. get: function get() {
  22946. var len = 0;
  22947. this.intervals.map(function (i) {
  22948. len += i.length;
  22949. });
  22950. return len;
  22951. }
  22952. });
  22953. IntervalSet.prototype.removeRange = function (v) {
  22954. if (v.start === v.stop - 1) {
  22955. this.removeOne(v.start);
  22956. } else if (this.intervals !== null) {
  22957. var k = 0;
  22958. for (var n = 0; n < this.intervals.length; n++) {
  22959. var i = this.intervals[k];
  22960. // intervals are ordered
  22961. if (v.stop <= i.start) {
  22962. return;
  22963. }
  22964. // check for including range, split it
  22965. else if (v.start > i.start && v.stop < i.stop) {
  22966. this.intervals[k] = new Interval(i.start, v.start);
  22967. var x = new Interval(v.stop, i.stop);
  22968. this.intervals.splice(k, 0, x);
  22969. return;
  22970. }
  22971. // check for included range, remove it
  22972. else if (v.start <= i.start && v.stop >= i.stop) {
  22973. this.intervals.splice(k, 1);
  22974. k = k - 1; // need another pass
  22975. }
  22976. // check for lower boundary
  22977. else if (v.start < i.stop) {
  22978. this.intervals[k] = new Interval(i.start, v.start);
  22979. }
  22980. // check for upper boundary
  22981. else if (v.stop < i.stop) {
  22982. this.intervals[k] = new Interval(v.stop, i.stop);
  22983. }
  22984. k += 1;
  22985. }
  22986. }
  22987. };
  22988. IntervalSet.prototype.removeOne = function (v) {
  22989. if (this.intervals !== null) {
  22990. for (var k = 0; k < this.intervals.length; k++) {
  22991. var i = this.intervals[k];
  22992. // intervals is ordered
  22993. if (v < i.start) {
  22994. return;
  22995. }
  22996. // check for single value range
  22997. else if (v === i.start && v === i.stop - 1) {
  22998. this.intervals.splice(k, 1);
  22999. return;
  23000. }
  23001. // check for lower boundary
  23002. else if (v === i.start) {
  23003. this.intervals[k] = new Interval(i.start + 1, i.stop);
  23004. return;
  23005. }
  23006. // check for upper boundary
  23007. else if (v === i.stop - 1) {
  23008. this.intervals[k] = new Interval(i.start, i.stop - 1);
  23009. return;
  23010. }
  23011. // split existing range
  23012. else if (v < i.stop - 1) {
  23013. var x = new Interval(i.start, v);
  23014. i.start = v + 1;
  23015. this.intervals.splice(k, 0, x);
  23016. return;
  23017. }
  23018. }
  23019. }
  23020. };
  23021. IntervalSet.prototype.toString = function (literalNames, symbolicNames, elemsAreChar) {
  23022. literalNames = literalNames || null;
  23023. symbolicNames = symbolicNames || null;
  23024. elemsAreChar = elemsAreChar || false;
  23025. if (this.intervals === null) {
  23026. return "{}";
  23027. } else if (literalNames !== null || symbolicNames !== null) {
  23028. return this.toTokenString(literalNames, symbolicNames);
  23029. } else if (elemsAreChar) {
  23030. return this.toCharString();
  23031. } else {
  23032. return this.toIndexString();
  23033. }
  23034. };
  23035. IntervalSet.prototype.toCharString = function () {
  23036. var names = [];
  23037. for (var i = 0; i < this.intervals.length; i++) {
  23038. var v = this.intervals[i];
  23039. if (v.stop === v.start + 1) {
  23040. if (v.start === Token.EOF) {
  23041. names.push("<EOF>");
  23042. } else {
  23043. names.push("'" + String.fromCharCode(v.start) + "'");
  23044. }
  23045. } else {
  23046. names.push("'" + String.fromCharCode(v.start) + "'..'" + String.fromCharCode(v.stop - 1) + "'");
  23047. }
  23048. }
  23049. if (names.length > 1) {
  23050. return "{" + names.join(", ") + "}";
  23051. } else {
  23052. return names[0];
  23053. }
  23054. };
  23055. IntervalSet.prototype.toIndexString = function () {
  23056. var names = [];
  23057. for (var i = 0; i < this.intervals.length; i++) {
  23058. var v = this.intervals[i];
  23059. if (v.stop === v.start + 1) {
  23060. if (v.start === Token.EOF) {
  23061. names.push("<EOF>");
  23062. } else {
  23063. names.push(v.start.toString());
  23064. }
  23065. } else {
  23066. names.push(v.start.toString() + ".." + (v.stop - 1).toString());
  23067. }
  23068. }
  23069. if (names.length > 1) {
  23070. return "{" + names.join(", ") + "}";
  23071. } else {
  23072. return names[0];
  23073. }
  23074. };
  23075. IntervalSet.prototype.toTokenString = function (literalNames, symbolicNames) {
  23076. var names = [];
  23077. for (var i = 0; i < this.intervals.length; i++) {
  23078. var v = this.intervals[i];
  23079. for (var j = v.start; j < v.stop; j++) {
  23080. names.push(this.elementName(literalNames, symbolicNames, j));
  23081. }
  23082. }
  23083. if (names.length > 1) {
  23084. return "{" + names.join(", ") + "}";
  23085. } else {
  23086. return names[0];
  23087. }
  23088. };
  23089. IntervalSet.prototype.elementName = function (literalNames, symbolicNames, a) {
  23090. if (a === Token.EOF) {
  23091. return "<EOF>";
  23092. } else if (a === Token.EPSILON) {
  23093. return "<EPSILON>";
  23094. } else {
  23095. return literalNames[a] || symbolicNames[a];
  23096. }
  23097. };
  23098. exports.Interval = Interval;
  23099. exports.IntervalSet = IntervalSet;
  23100. /***/ }),
  23101. /***/ "./node_modules/antlr4/LL1Analyzer.js":
  23102. /*!********************************************!*\
  23103. !*** ./node_modules/antlr4/LL1Analyzer.js ***!
  23104. \********************************************/
  23105. /*! no static exports found */
  23106. /***/ (function(module, exports, __webpack_require__) {
  23107. "use strict";
  23108. //
  23109. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  23110. * Use of this file is governed by the BSD 3-clause license that
  23111. * can be found in the LICENSE.txt file in the project root.
  23112. */
  23113. ///
  23114. var Set = __webpack_require__(/*! ./Utils */ "./node_modules/antlr4/Utils.js").Set;
  23115. var BitSet = __webpack_require__(/*! ./Utils */ "./node_modules/antlr4/Utils.js").BitSet;
  23116. var Token = __webpack_require__(/*! ./Token */ "./node_modules/antlr4/Token.js").Token;
  23117. var ATNConfig = __webpack_require__(/*! ./atn/ATNConfig */ "./node_modules/antlr4/atn/ATNConfig.js").ATNConfig;
  23118. var Interval = __webpack_require__(/*! ./IntervalSet */ "./node_modules/antlr4/IntervalSet.js").Interval;
  23119. var IntervalSet = __webpack_require__(/*! ./IntervalSet */ "./node_modules/antlr4/IntervalSet.js").IntervalSet;
  23120. var RuleStopState = __webpack_require__(/*! ./atn/ATNState */ "./node_modules/antlr4/atn/ATNState.js").RuleStopState;
  23121. var RuleTransition = __webpack_require__(/*! ./atn/Transition */ "./node_modules/antlr4/atn/Transition.js").RuleTransition;
  23122. var NotSetTransition = __webpack_require__(/*! ./atn/Transition */ "./node_modules/antlr4/atn/Transition.js").NotSetTransition;
  23123. var WildcardTransition = __webpack_require__(/*! ./atn/Transition */ "./node_modules/antlr4/atn/Transition.js").WildcardTransition;
  23124. var AbstractPredicateTransition = __webpack_require__(/*! ./atn/Transition */ "./node_modules/antlr4/atn/Transition.js").AbstractPredicateTransition;
  23125. var pc = __webpack_require__(/*! ./PredictionContext */ "./node_modules/antlr4/PredictionContext.js");
  23126. var predictionContextFromRuleContext = pc.predictionContextFromRuleContext;
  23127. var PredictionContext = pc.PredictionContext;
  23128. var SingletonPredictionContext = pc.SingletonPredictionContext;
  23129. function LL1Analyzer(atn) {
  23130. this.atn = atn;
  23131. }
  23132. //* Special value added to the lookahead sets to indicate that we hit
  23133. // a predicate during analysis if {@code seeThruPreds==false}.
  23134. ///
  23135. LL1Analyzer.HIT_PRED = Token.INVALID_TYPE;
  23136. //*
  23137. // Calculates the SLL(1) expected lookahead set for each outgoing transition
  23138. // of an {@link ATNState}. The returned array has one element for each
  23139. // outgoing transition in {@code s}. If the closure from transition
  23140. // <em>i</em> leads to a semantic predicate before matching a symbol, the
  23141. // element at index <em>i</em> of the result will be {@code null}.
  23142. //
  23143. // @param s the ATN state
  23144. // @return the expected symbols for each outgoing transition of {@code s}.
  23145. ///
  23146. LL1Analyzer.prototype.getDecisionLookahead = function (s) {
  23147. if (s === null) {
  23148. return null;
  23149. }
  23150. var count = s.transitions.length;
  23151. var look = [];
  23152. for (var alt = 0; alt < count; alt++) {
  23153. look[alt] = new IntervalSet();
  23154. var lookBusy = new Set();
  23155. var seeThruPreds = false; // fail to get lookahead upon pred
  23156. this._LOOK(s.transition(alt).target, null, PredictionContext.EMPTY, look[alt], lookBusy, new BitSet(), seeThruPreds, false);
  23157. // Wipe out lookahead for this alternative if we found nothing
  23158. // or we had a predicate when we !seeThruPreds
  23159. if (look[alt].length === 0 || look[alt].contains(LL1Analyzer.HIT_PRED)) {
  23160. look[alt] = null;
  23161. }
  23162. }
  23163. return look;
  23164. };
  23165. //*
  23166. // Compute set of tokens that can follow {@code s} in the ATN in the
  23167. // specified {@code ctx}.
  23168. //
  23169. // <p>If {@code ctx} is {@code null} and the end of the rule containing
  23170. // {@code s} is reached, {@link Token//EPSILON} is added to the result set.
  23171. // If {@code ctx} is not {@code null} and the end of the outermost rule is
  23172. // reached, {@link Token//EOF} is added to the result set.</p>
  23173. //
  23174. // @param s the ATN state
  23175. // @param stopState the ATN state to stop at. This can be a
  23176. // {@link BlockEndState} to detect epsilon paths through a closure.
  23177. // @param ctx the complete parser context, or {@code null} if the context
  23178. // should be ignored
  23179. //
  23180. // @return The set of tokens that can follow {@code s} in the ATN in the
  23181. // specified {@code ctx}.
  23182. ///
  23183. LL1Analyzer.prototype.LOOK = function (s, stopState, ctx) {
  23184. var r = new IntervalSet();
  23185. var seeThruPreds = true; // ignore preds; get all lookahead
  23186. ctx = ctx || null;
  23187. var lookContext = ctx !== null ? predictionContextFromRuleContext(s.atn, ctx) : null;
  23188. this._LOOK(s, stopState, lookContext, r, new Set(), new BitSet(), seeThruPreds, true);
  23189. return r;
  23190. };
  23191. //*
  23192. // Compute set of tokens that can follow {@code s} in the ATN in the
  23193. // specified {@code ctx}.
  23194. //
  23195. // <p>If {@code ctx} is {@code null} and {@code stopState} or the end of the
  23196. // rule containing {@code s} is reached, {@link Token//EPSILON} is added to
  23197. // the result set. If {@code ctx} is not {@code null} and {@code addEOF} is
  23198. // {@code true} and {@code stopState} or the end of the outermost rule is
  23199. // reached, {@link Token//EOF} is added to the result set.</p>
  23200. //
  23201. // @param s the ATN state.
  23202. // @param stopState the ATN state to stop at. This can be a
  23203. // {@link BlockEndState} to detect epsilon paths through a closure.
  23204. // @param ctx The outer context, or {@code null} if the outer context should
  23205. // not be used.
  23206. // @param look The result lookahead set.
  23207. // @param lookBusy A set used for preventing epsilon closures in the ATN
  23208. // from causing a stack overflow. Outside code should pass
  23209. // {@code new Set<ATNConfig>} for this argument.
  23210. // @param calledRuleStack A set used for preventing left recursion in the
  23211. // ATN from causing a stack overflow. Outside code should pass
  23212. // {@code new BitSet()} for this argument.
  23213. // @param seeThruPreds {@code true} to true semantic predicates as
  23214. // implicitly {@code true} and "see through them", otherwise {@code false}
  23215. // to treat semantic predicates as opaque and add {@link //HIT_PRED} to the
  23216. // result if one is encountered.
  23217. // @param addEOF Add {@link Token//EOF} to the result if the end of the
  23218. // outermost context is reached. This parameter has no effect if {@code ctx}
  23219. // is {@code null}.
  23220. ///
  23221. LL1Analyzer.prototype._LOOK = function (s, stopState, ctx, look, lookBusy, calledRuleStack, seeThruPreds, addEOF) {
  23222. var c = new ATNConfig({ state: s, alt: 0, context: ctx }, null);
  23223. if (lookBusy.contains(c)) {
  23224. return;
  23225. }
  23226. lookBusy.add(c);
  23227. if (s === stopState) {
  23228. if (ctx === null) {
  23229. look.addOne(Token.EPSILON);
  23230. return;
  23231. } else if (ctx.isEmpty() && addEOF) {
  23232. look.addOne(Token.EOF);
  23233. return;
  23234. }
  23235. }
  23236. if (s instanceof RuleStopState) {
  23237. if (ctx === null) {
  23238. look.addOne(Token.EPSILON);
  23239. return;
  23240. } else if (ctx.isEmpty() && addEOF) {
  23241. look.addOne(Token.EOF);
  23242. return;
  23243. }
  23244. if (ctx !== PredictionContext.EMPTY) {
  23245. // run thru all possible stack tops in ctx
  23246. for (var i = 0; i < ctx.length; i++) {
  23247. var returnState = this.atn.states[ctx.getReturnState(i)];
  23248. var removed = calledRuleStack.contains(returnState.ruleIndex);
  23249. try {
  23250. calledRuleStack.remove(returnState.ruleIndex);
  23251. this._LOOK(returnState, stopState, ctx.getParent(i), look, lookBusy, calledRuleStack, seeThruPreds, addEOF);
  23252. } finally {
  23253. if (removed) {
  23254. calledRuleStack.add(returnState.ruleIndex);
  23255. }
  23256. }
  23257. }
  23258. return;
  23259. }
  23260. }
  23261. for (var j = 0; j < s.transitions.length; j++) {
  23262. var t = s.transitions[j];
  23263. if (t.constructor === RuleTransition) {
  23264. if (calledRuleStack.contains(t.target.ruleIndex)) {
  23265. continue;
  23266. }
  23267. var newContext = SingletonPredictionContext.create(ctx, t.followState.stateNumber);
  23268. try {
  23269. calledRuleStack.add(t.target.ruleIndex);
  23270. this._LOOK(t.target, stopState, newContext, look, lookBusy, calledRuleStack, seeThruPreds, addEOF);
  23271. } finally {
  23272. calledRuleStack.remove(t.target.ruleIndex);
  23273. }
  23274. } else if (t instanceof AbstractPredicateTransition) {
  23275. if (seeThruPreds) {
  23276. this._LOOK(t.target, stopState, ctx, look, lookBusy, calledRuleStack, seeThruPreds, addEOF);
  23277. } else {
  23278. look.addOne(LL1Analyzer.HIT_PRED);
  23279. }
  23280. } else if (t.isEpsilon) {
  23281. this._LOOK(t.target, stopState, ctx, look, lookBusy, calledRuleStack, seeThruPreds, addEOF);
  23282. } else if (t.constructor === WildcardTransition) {
  23283. look.addRange(Token.MIN_USER_TOKEN_TYPE, this.atn.maxTokenType);
  23284. } else {
  23285. var set = t.label;
  23286. if (set !== null) {
  23287. if (t instanceof NotSetTransition) {
  23288. set = set.complement(Token.MIN_USER_TOKEN_TYPE, this.atn.maxTokenType);
  23289. }
  23290. look.addSet(set);
  23291. }
  23292. }
  23293. }
  23294. };
  23295. exports.LL1Analyzer = LL1Analyzer;
  23296. /***/ }),
  23297. /***/ "./node_modules/antlr4/Lexer.js":
  23298. /*!**************************************!*\
  23299. !*** ./node_modules/antlr4/Lexer.js ***!
  23300. \**************************************/
  23301. /*! no static exports found */
  23302. /***/ (function(module, exports, __webpack_require__) {
  23303. "use strict";
  23304. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  23305. * Use of this file is governed by the BSD 3-clause license that
  23306. * can be found in the LICENSE.txt file in the project root.
  23307. */
  23308. ///
  23309. // A lexer is recognizer that draws input symbols from a character stream.
  23310. // lexer grammars result in a subclass of this object. A Lexer object
  23311. // uses simplified match() and error recovery mechanisms in the interest of speed.
  23312. var Token = __webpack_require__(/*! ./Token */ "./node_modules/antlr4/Token.js").Token;
  23313. var Recognizer = __webpack_require__(/*! ./Recognizer */ "./node_modules/antlr4/Recognizer.js").Recognizer;
  23314. var CommonTokenFactory = __webpack_require__(/*! ./CommonTokenFactory */ "./node_modules/antlr4/CommonTokenFactory.js").CommonTokenFactory;
  23315. var RecognitionException = __webpack_require__(/*! ./error/Errors */ "./node_modules/antlr4/error/Errors.js").RecognitionException;
  23316. var LexerNoViableAltException = __webpack_require__(/*! ./error/Errors */ "./node_modules/antlr4/error/Errors.js").LexerNoViableAltException;
  23317. function TokenSource() {
  23318. return this;
  23319. }
  23320. function Lexer(input) {
  23321. Recognizer.call(this);
  23322. this._input = input;
  23323. this._factory = CommonTokenFactory.DEFAULT;
  23324. this._tokenFactorySourcePair = [this, input];
  23325. this._interp = null; // child classes must populate this
  23326. // The goal of all lexer rules/methods is to create a token object.
  23327. // this is an instance variable as multiple rules may collaborate to
  23328. // create a single token. nextToken will return this object after
  23329. // matching lexer rule(s). If you subclass to allow multiple token
  23330. // emissions, then set this to the last token to be matched or
  23331. // something nonnull so that the auto token emit mechanism will not
  23332. // emit another token.
  23333. this._token = null;
  23334. // What character index in the stream did the current token start at?
  23335. // Needed, for example, to get the text for current token. Set at
  23336. // the start of nextToken.
  23337. this._tokenStartCharIndex = -1;
  23338. // The line on which the first character of the token resides///
  23339. this._tokenStartLine = -1;
  23340. // The character position of first character within the line///
  23341. this._tokenStartColumn = -1;
  23342. // Once we see EOF on char stream, next token will be EOF.
  23343. // If you have DONE : EOF ; then you see DONE EOF.
  23344. this._hitEOF = false;
  23345. // The channel number for the current token///
  23346. this._channel = Token.DEFAULT_CHANNEL;
  23347. // The token type for the current token///
  23348. this._type = Token.INVALID_TYPE;
  23349. this._modeStack = [];
  23350. this._mode = Lexer.DEFAULT_MODE;
  23351. // You can set the text for the current token to override what is in
  23352. // the input char buffer. Use setText() or can set this instance var.
  23353. // /
  23354. this._text = null;
  23355. return this;
  23356. }
  23357. Lexer.prototype = Object.create(Recognizer.prototype);
  23358. Lexer.prototype.constructor = Lexer;
  23359. Lexer.DEFAULT_MODE = 0;
  23360. Lexer.MORE = -2;
  23361. Lexer.SKIP = -3;
  23362. Lexer.DEFAULT_TOKEN_CHANNEL = Token.DEFAULT_CHANNEL;
  23363. Lexer.HIDDEN = Token.HIDDEN_CHANNEL;
  23364. Lexer.MIN_CHAR_VALUE = 0x0000;
  23365. Lexer.MAX_CHAR_VALUE = 0x10FFFF;
  23366. Lexer.prototype.reset = function () {
  23367. // wack Lexer state variables
  23368. if (this._input !== null) {
  23369. this._input.seek(0); // rewind the input
  23370. }
  23371. this._token = null;
  23372. this._type = Token.INVALID_TYPE;
  23373. this._channel = Token.DEFAULT_CHANNEL;
  23374. this._tokenStartCharIndex = -1;
  23375. this._tokenStartColumn = -1;
  23376. this._tokenStartLine = -1;
  23377. this._text = null;
  23378. this._hitEOF = false;
  23379. this._mode = Lexer.DEFAULT_MODE;
  23380. this._modeStack = [];
  23381. this._interp.reset();
  23382. };
  23383. // Return a token from this source; i.e., match a token on the char stream.
  23384. Lexer.prototype.nextToken = function () {
  23385. if (this._input === null) {
  23386. throw "nextToken requires a non-null input stream.";
  23387. }
  23388. // Mark start location in char stream so unbuffered streams are
  23389. // guaranteed at least have text of current token
  23390. var tokenStartMarker = this._input.mark();
  23391. try {
  23392. while (true) {
  23393. if (this._hitEOF) {
  23394. this.emitEOF();
  23395. return this._token;
  23396. }
  23397. this._token = null;
  23398. this._channel = Token.DEFAULT_CHANNEL;
  23399. this._tokenStartCharIndex = this._input.index;
  23400. this._tokenStartColumn = this._interp.column;
  23401. this._tokenStartLine = this._interp.line;
  23402. this._text = null;
  23403. var continueOuter = false;
  23404. while (true) {
  23405. this._type = Token.INVALID_TYPE;
  23406. var ttype = Lexer.SKIP;
  23407. try {
  23408. ttype = this._interp.match(this._input, this._mode);
  23409. } catch (e) {
  23410. if (e instanceof RecognitionException) {
  23411. this.notifyListeners(e); // report error
  23412. this.recover(e);
  23413. } else {
  23414. console.log(e.stack);
  23415. throw e;
  23416. }
  23417. }
  23418. if (this._input.LA(1) === Token.EOF) {
  23419. this._hitEOF = true;
  23420. }
  23421. if (this._type === Token.INVALID_TYPE) {
  23422. this._type = ttype;
  23423. }
  23424. if (this._type === Lexer.SKIP) {
  23425. continueOuter = true;
  23426. break;
  23427. }
  23428. if (this._type !== Lexer.MORE) {
  23429. break;
  23430. }
  23431. }
  23432. if (continueOuter) {
  23433. continue;
  23434. }
  23435. if (this._token === null) {
  23436. this.emit();
  23437. }
  23438. return this._token;
  23439. }
  23440. } finally {
  23441. // make sure we release marker after match or
  23442. // unbuffered char stream will keep buffering
  23443. this._input.release(tokenStartMarker);
  23444. }
  23445. };
  23446. // Instruct the lexer to skip creating a token for current lexer rule
  23447. // and look for another token. nextToken() knows to keep looking when
  23448. // a lexer rule finishes with token set to SKIP_TOKEN. Recall that
  23449. // if token==null at end of any token rule, it creates one for you
  23450. // and emits it.
  23451. // /
  23452. Lexer.prototype.skip = function () {
  23453. this._type = Lexer.SKIP;
  23454. };
  23455. Lexer.prototype.more = function () {
  23456. this._type = Lexer.MORE;
  23457. };
  23458. Lexer.prototype.mode = function (m) {
  23459. this._mode = m;
  23460. };
  23461. Lexer.prototype.pushMode = function (m) {
  23462. if (this._interp.debug) {
  23463. console.log("pushMode " + m);
  23464. }
  23465. this._modeStack.push(this._mode);
  23466. this.mode(m);
  23467. };
  23468. Lexer.prototype.popMode = function () {
  23469. if (this._modeStack.length === 0) {
  23470. throw "Empty Stack";
  23471. }
  23472. if (this._interp.debug) {
  23473. console.log("popMode back to " + this._modeStack.slice(0, -1));
  23474. }
  23475. this.mode(this._modeStack.pop());
  23476. return this._mode;
  23477. };
  23478. // Set the char stream and reset the lexer
  23479. Object.defineProperty(Lexer.prototype, "inputStream", {
  23480. get: function get() {
  23481. return this._input;
  23482. },
  23483. set: function set(input) {
  23484. this._input = null;
  23485. this._tokenFactorySourcePair = [this, this._input];
  23486. this.reset();
  23487. this._input = input;
  23488. this._tokenFactorySourcePair = [this, this._input];
  23489. }
  23490. });
  23491. Object.defineProperty(Lexer.prototype, "sourceName", {
  23492. get: function sourceName() {
  23493. return this._input.sourceName;
  23494. }
  23495. });
  23496. // By default does not support multiple emits per nextToken invocation
  23497. // for efficiency reasons. Subclass and override this method, nextToken,
  23498. // and getToken (to push tokens into a list and pull from that list
  23499. // rather than a single variable as this implementation does).
  23500. // /
  23501. Lexer.prototype.emitToken = function (token) {
  23502. this._token = token;
  23503. };
  23504. // The standard method called to automatically emit a token at the
  23505. // outermost lexical rule. The token object should point into the
  23506. // char buffer start..stop. If there is a text override in 'text',
  23507. // use that to set the token's text. Override this method to emit
  23508. // custom Token objects or provide a new factory.
  23509. // /
  23510. Lexer.prototype.emit = function () {
  23511. var t = this._factory.create(this._tokenFactorySourcePair, this._type, this._text, this._channel, this._tokenStartCharIndex, this.getCharIndex() - 1, this._tokenStartLine, this._tokenStartColumn);
  23512. this.emitToken(t);
  23513. return t;
  23514. };
  23515. Lexer.prototype.emitEOF = function () {
  23516. var cpos = this.column;
  23517. var lpos = this.line;
  23518. var eof = this._factory.create(this._tokenFactorySourcePair, Token.EOF, null, Token.DEFAULT_CHANNEL, this._input.index, this._input.index - 1, lpos, cpos);
  23519. this.emitToken(eof);
  23520. return eof;
  23521. };
  23522. Object.defineProperty(Lexer.prototype, "type", {
  23523. get: function get() {
  23524. return this.type;
  23525. },
  23526. set: function set(type) {
  23527. this._type = type;
  23528. }
  23529. });
  23530. Object.defineProperty(Lexer.prototype, "line", {
  23531. get: function get() {
  23532. return this._interp.line;
  23533. },
  23534. set: function set(line) {
  23535. this._interp.line = line;
  23536. }
  23537. });
  23538. Object.defineProperty(Lexer.prototype, "column", {
  23539. get: function get() {
  23540. return this._interp.column;
  23541. },
  23542. set: function set(column) {
  23543. this._interp.column = column;
  23544. }
  23545. });
  23546. // What is the index of the current character of lookahead?///
  23547. Lexer.prototype.getCharIndex = function () {
  23548. return this._input.index;
  23549. };
  23550. // Return the text matched so far for the current token or any text override.
  23551. //Set the complete text of this token; it wipes any previous changes to the text.
  23552. Object.defineProperty(Lexer.prototype, "text", {
  23553. get: function get() {
  23554. if (this._text !== null) {
  23555. return this._text;
  23556. } else {
  23557. return this._interp.getText(this._input);
  23558. }
  23559. },
  23560. set: function set(text) {
  23561. this._text = text;
  23562. }
  23563. });
  23564. // Return a list of all Token objects in input char stream.
  23565. // Forces load of all tokens. Does not include EOF token.
  23566. // /
  23567. Lexer.prototype.getAllTokens = function () {
  23568. var tokens = [];
  23569. var t = this.nextToken();
  23570. while (t.type !== Token.EOF) {
  23571. tokens.push(t);
  23572. t = this.nextToken();
  23573. }
  23574. return tokens;
  23575. };
  23576. Lexer.prototype.notifyListeners = function (e) {
  23577. var start = this._tokenStartCharIndex;
  23578. var stop = this._input.index;
  23579. var text = this._input.getText(start, stop);
  23580. var msg = "token recognition error at: '" + this.getErrorDisplay(text) + "'";
  23581. var listener = this.getErrorListenerDispatch();
  23582. listener.syntaxError(this, null, this._tokenStartLine, this._tokenStartColumn, msg, e);
  23583. };
  23584. Lexer.prototype.getErrorDisplay = function (s) {
  23585. var d = [];
  23586. for (var i = 0; i < s.length; i++) {
  23587. d.push(s[i]);
  23588. }
  23589. return d.join('');
  23590. };
  23591. Lexer.prototype.getErrorDisplayForChar = function (c) {
  23592. if (c.charCodeAt(0) === Token.EOF) {
  23593. return "<EOF>";
  23594. } else if (c === '\n') {
  23595. return "\\n";
  23596. } else if (c === '\t') {
  23597. return "\\t";
  23598. } else if (c === '\r') {
  23599. return "\\r";
  23600. } else {
  23601. return c;
  23602. }
  23603. };
  23604. Lexer.prototype.getCharErrorDisplay = function (c) {
  23605. return "'" + this.getErrorDisplayForChar(c) + "'";
  23606. };
  23607. // Lexers can normally match any char in it's vocabulary after matching
  23608. // a token, so do the easy thing and just kill a character and hope
  23609. // it all works out. You can instead use the rule invocation stack
  23610. // to do sophisticated error recovery if you are in a fragment rule.
  23611. // /
  23612. Lexer.prototype.recover = function (re) {
  23613. if (this._input.LA(1) !== Token.EOF) {
  23614. if (re instanceof LexerNoViableAltException) {
  23615. // skip a char and try again
  23616. this._interp.consume(this._input);
  23617. } else {
  23618. // TODO: Do we lose character or line position information?
  23619. this._input.consume();
  23620. }
  23621. }
  23622. };
  23623. exports.Lexer = Lexer;
  23624. /***/ }),
  23625. /***/ "./node_modules/antlr4/Parser.js":
  23626. /*!***************************************!*\
  23627. !*** ./node_modules/antlr4/Parser.js ***!
  23628. \***************************************/
  23629. /*! no static exports found */
  23630. /***/ (function(module, exports, __webpack_require__) {
  23631. "use strict";
  23632. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  23633. * Use of this file is governed by the BSD 3-clause license that
  23634. * can be found in the LICENSE.txt file in the project root.
  23635. */
  23636. var Token = __webpack_require__(/*! ./Token */ "./node_modules/antlr4/Token.js").Token;
  23637. var ParseTreeListener = __webpack_require__(/*! ./tree/Tree */ "./node_modules/antlr4/tree/Tree.js").ParseTreeListener;
  23638. var Recognizer = __webpack_require__(/*! ./Recognizer */ "./node_modules/antlr4/Recognizer.js").Recognizer;
  23639. var DefaultErrorStrategy = __webpack_require__(/*! ./error/ErrorStrategy */ "./node_modules/antlr4/error/ErrorStrategy.js").DefaultErrorStrategy;
  23640. var ATNDeserializer = __webpack_require__(/*! ./atn/ATNDeserializer */ "./node_modules/antlr4/atn/ATNDeserializer.js").ATNDeserializer;
  23641. var ATNDeserializationOptions = __webpack_require__(/*! ./atn/ATNDeserializationOptions */ "./node_modules/antlr4/atn/ATNDeserializationOptions.js").ATNDeserializationOptions;
  23642. var TerminalNode = __webpack_require__(/*! ./tree/Tree */ "./node_modules/antlr4/tree/Tree.js").TerminalNode;
  23643. var ErrorNode = __webpack_require__(/*! ./tree/Tree */ "./node_modules/antlr4/tree/Tree.js").ErrorNode;
  23644. function TraceListener(parser) {
  23645. ParseTreeListener.call(this);
  23646. this.parser = parser;
  23647. return this;
  23648. }
  23649. TraceListener.prototype = Object.create(ParseTreeListener.prototype);
  23650. TraceListener.prototype.constructor = TraceListener;
  23651. TraceListener.prototype.enterEveryRule = function (ctx) {
  23652. console.log("enter " + this.parser.ruleNames[ctx.ruleIndex] + ", LT(1)=" + this.parser._input.LT(1).text);
  23653. };
  23654. TraceListener.prototype.visitTerminal = function (node) {
  23655. console.log("consume " + node.symbol + " rule " + this.parser.ruleNames[this.parser._ctx.ruleIndex]);
  23656. };
  23657. TraceListener.prototype.exitEveryRule = function (ctx) {
  23658. console.log("exit " + this.parser.ruleNames[ctx.ruleIndex] + ", LT(1)=" + this.parser._input.LT(1).text);
  23659. };
  23660. // this is all the parsing support code essentially; most of it is error
  23661. // recovery stuff.//
  23662. function Parser(input) {
  23663. Recognizer.call(this);
  23664. // The input stream.
  23665. this._input = null;
  23666. // The error handling strategy for the parser. The default value is a new
  23667. // instance of {@link DefaultErrorStrategy}.
  23668. this._errHandler = new DefaultErrorStrategy();
  23669. this._precedenceStack = [];
  23670. this._precedenceStack.push(0);
  23671. // The {@link ParserRuleContext} object for the currently executing rule.
  23672. // this is always non-null during the parsing process.
  23673. this._ctx = null;
  23674. // Specifies whether or not the parser should construct a parse tree during
  23675. // the parsing process. The default value is {@code true}.
  23676. this.buildParseTrees = true;
  23677. // When {@link //setTrace}{@code (true)} is called, a reference to the
  23678. // {@link TraceListener} is stored here so it can be easily removed in a
  23679. // later call to {@link //setTrace}{@code (false)}. The listener itself is
  23680. // implemented as a parser listener so this field is not directly used by
  23681. // other parser methods.
  23682. this._tracer = null;
  23683. // The list of {@link ParseTreeListener} listeners registered to receive
  23684. // events during the parse.
  23685. this._parseListeners = null;
  23686. // The number of syntax errors reported during parsing. this value is
  23687. // incremented each time {@link //notifyErrorListeners} is called.
  23688. this._syntaxErrors = 0;
  23689. this.setInputStream(input);
  23690. return this;
  23691. }
  23692. Parser.prototype = Object.create(Recognizer.prototype);
  23693. Parser.prototype.contructor = Parser;
  23694. // this field maps from the serialized ATN string to the deserialized {@link
  23695. // ATN} with
  23696. // bypass alternatives.
  23697. //
  23698. // @see ATNDeserializationOptions//isGenerateRuleBypassTransitions()
  23699. //
  23700. Parser.bypassAltsAtnCache = {};
  23701. // reset the parser's state//
  23702. Parser.prototype.reset = function () {
  23703. if (this._input !== null) {
  23704. this._input.seek(0);
  23705. }
  23706. this._errHandler.reset(this);
  23707. this._ctx = null;
  23708. this._syntaxErrors = 0;
  23709. this.setTrace(false);
  23710. this._precedenceStack = [];
  23711. this._precedenceStack.push(0);
  23712. if (this._interp !== null) {
  23713. this._interp.reset();
  23714. }
  23715. };
  23716. // Match current input symbol against {@code ttype}. If the symbol type
  23717. // matches, {@link ANTLRErrorStrategy//reportMatch} and {@link //consume} are
  23718. // called to complete the match process.
  23719. //
  23720. // <p>If the symbol type does not match,
  23721. // {@link ANTLRErrorStrategy//recoverInline} is called on the current error
  23722. // strategy to attempt recovery. If {@link //getBuildParseTree} is
  23723. // {@code true} and the token index of the symbol returned by
  23724. // {@link ANTLRErrorStrategy//recoverInline} is -1, the symbol is added to
  23725. // the parse tree by calling {@link ParserRuleContext//addErrorNode}.</p>
  23726. //
  23727. // @param ttype the token type to match
  23728. // @return the matched symbol
  23729. // @throws RecognitionException if the current input symbol did not match
  23730. // {@code ttype} and the error strategy could not recover from the
  23731. // mismatched symbol
  23732. Parser.prototype.match = function (ttype) {
  23733. var t = this.getCurrentToken();
  23734. if (t.type === ttype) {
  23735. this._errHandler.reportMatch(this);
  23736. this.consume();
  23737. } else {
  23738. t = this._errHandler.recoverInline(this);
  23739. if (this.buildParseTrees && t.tokenIndex === -1) {
  23740. // we must have conjured up a new token during single token
  23741. // insertion
  23742. // if it's not the current symbol
  23743. this._ctx.addErrorNode(t);
  23744. }
  23745. }
  23746. return t;
  23747. };
  23748. // Match current input symbol as a wildcard. If the symbol type matches
  23749. // (i.e. has a value greater than 0), {@link ANTLRErrorStrategy//reportMatch}
  23750. // and {@link //consume} are called to complete the match process.
  23751. //
  23752. // <p>If the symbol type does not match,
  23753. // {@link ANTLRErrorStrategy//recoverInline} is called on the current error
  23754. // strategy to attempt recovery. If {@link //getBuildParseTree} is
  23755. // {@code true} and the token index of the symbol returned by
  23756. // {@link ANTLRErrorStrategy//recoverInline} is -1, the symbol is added to
  23757. // the parse tree by calling {@link ParserRuleContext//addErrorNode}.</p>
  23758. //
  23759. // @return the matched symbol
  23760. // @throws RecognitionException if the current input symbol did not match
  23761. // a wildcard and the error strategy could not recover from the mismatched
  23762. // symbol
  23763. Parser.prototype.matchWildcard = function () {
  23764. var t = this.getCurrentToken();
  23765. if (t.type > 0) {
  23766. this._errHandler.reportMatch(this);
  23767. this.consume();
  23768. } else {
  23769. t = this._errHandler.recoverInline(this);
  23770. if (this._buildParseTrees && t.tokenIndex === -1) {
  23771. // we must have conjured up a new token during single token
  23772. // insertion
  23773. // if it's not the current symbol
  23774. this._ctx.addErrorNode(t);
  23775. }
  23776. }
  23777. return t;
  23778. };
  23779. Parser.prototype.getParseListeners = function () {
  23780. return this._parseListeners || [];
  23781. };
  23782. // Registers {@code listener} to receive events during the parsing process.
  23783. //
  23784. // <p>To support output-preserving grammar transformations (including but not
  23785. // limited to left-recursion removal, automated left-factoring, and
  23786. // optimized code generation), calls to listener methods during the parse
  23787. // may differ substantially from calls made by
  23788. // {@link ParseTreeWalker//DEFAULT} used after the parse is complete. In
  23789. // particular, rule entry and exit events may occur in a different order
  23790. // during the parse than after the parser. In addition, calls to certain
  23791. // rule entry methods may be omitted.</p>
  23792. //
  23793. // <p>With the following specific exceptions, calls to listener events are
  23794. // <em>deterministic</em>, i.e. for identical input the calls to listener
  23795. // methods will be the same.</p>
  23796. //
  23797. // <ul>
  23798. // <li>Alterations to the grammar used to generate code may change the
  23799. // behavior of the listener calls.</li>
  23800. // <li>Alterations to the command line options passed to ANTLR 4 when
  23801. // generating the parser may change the behavior of the listener calls.</li>
  23802. // <li>Changing the version of the ANTLR Tool used to generate the parser
  23803. // may change the behavior of the listener calls.</li>
  23804. // </ul>
  23805. //
  23806. // @param listener the listener to add
  23807. //
  23808. // @throws NullPointerException if {@code} listener is {@code null}
  23809. //
  23810. Parser.prototype.addParseListener = function (listener) {
  23811. if (listener === null) {
  23812. throw "listener";
  23813. }
  23814. if (this._parseListeners === null) {
  23815. this._parseListeners = [];
  23816. }
  23817. this._parseListeners.push(listener);
  23818. };
  23819. //
  23820. // Remove {@code listener} from the list of parse listeners.
  23821. //
  23822. // <p>If {@code listener} is {@code null} or has not been added as a parse
  23823. // listener, this method does nothing.</p>
  23824. // @param listener the listener to remove
  23825. //
  23826. Parser.prototype.removeParseListener = function (listener) {
  23827. if (this._parseListeners !== null) {
  23828. var idx = this._parseListeners.indexOf(listener);
  23829. if (idx >= 0) {
  23830. this._parseListeners.splice(idx, 1);
  23831. }
  23832. if (this._parseListeners.length === 0) {
  23833. this._parseListeners = null;
  23834. }
  23835. }
  23836. };
  23837. // Remove all parse listeners.
  23838. Parser.prototype.removeParseListeners = function () {
  23839. this._parseListeners = null;
  23840. };
  23841. // Notify any parse listeners of an enter rule event.
  23842. Parser.prototype.triggerEnterRuleEvent = function () {
  23843. if (this._parseListeners !== null) {
  23844. var ctx = this._ctx;
  23845. this._parseListeners.map(function (listener) {
  23846. listener.enterEveryRule(ctx);
  23847. ctx.enterRule(listener);
  23848. });
  23849. }
  23850. };
  23851. //
  23852. // Notify any parse listeners of an exit rule event.
  23853. //
  23854. // @see //addParseListener
  23855. //
  23856. Parser.prototype.triggerExitRuleEvent = function () {
  23857. if (this._parseListeners !== null) {
  23858. // reverse order walk of listeners
  23859. var ctx = this._ctx;
  23860. this._parseListeners.slice(0).reverse().map(function (listener) {
  23861. ctx.exitRule(listener);
  23862. listener.exitEveryRule(ctx);
  23863. });
  23864. }
  23865. };
  23866. Parser.prototype.getTokenFactory = function () {
  23867. return this._input.tokenSource._factory;
  23868. };
  23869. // Tell our token source and error strategy about a new way to create tokens.//
  23870. Parser.prototype.setTokenFactory = function (factory) {
  23871. this._input.tokenSource._factory = factory;
  23872. };
  23873. // The ATN with bypass alternatives is expensive to create so we create it
  23874. // lazily.
  23875. //
  23876. // @throws UnsupportedOperationException if the current parser does not
  23877. // implement the {@link //getSerializedATN()} method.
  23878. //
  23879. Parser.prototype.getATNWithBypassAlts = function () {
  23880. var serializedAtn = this.getSerializedATN();
  23881. if (serializedAtn === null) {
  23882. throw "The current parser does not support an ATN with bypass alternatives.";
  23883. }
  23884. var result = this.bypassAltsAtnCache[serializedAtn];
  23885. if (result === null) {
  23886. var deserializationOptions = new ATNDeserializationOptions();
  23887. deserializationOptions.generateRuleBypassTransitions = true;
  23888. result = new ATNDeserializer(deserializationOptions).deserialize(serializedAtn);
  23889. this.bypassAltsAtnCache[serializedAtn] = result;
  23890. }
  23891. return result;
  23892. };
  23893. // The preferred method of getting a tree pattern. For example, here's a
  23894. // sample use:
  23895. //
  23896. // <pre>
  23897. // ParseTree t = parser.expr();
  23898. // ParseTreePattern p = parser.compileParseTreePattern("&lt;ID&gt;+0",
  23899. // MyParser.RULE_expr);
  23900. // ParseTreeMatch m = p.match(t);
  23901. // String id = m.get("ID");
  23902. // </pre>
  23903. var Lexer = __webpack_require__(/*! ./Lexer */ "./node_modules/antlr4/Lexer.js").Lexer;
  23904. Parser.prototype.compileParseTreePattern = function (pattern, patternRuleIndex, lexer) {
  23905. lexer = lexer || null;
  23906. if (lexer === null) {
  23907. if (this.getTokenStream() !== null) {
  23908. var tokenSource = this.getTokenStream().tokenSource;
  23909. if (tokenSource instanceof Lexer) {
  23910. lexer = tokenSource;
  23911. }
  23912. }
  23913. }
  23914. if (lexer === null) {
  23915. throw "Parser can't discover a lexer to use";
  23916. }
  23917. var m = new ParseTreePatternMatcher(lexer, this);
  23918. return m.compile(pattern, patternRuleIndex);
  23919. };
  23920. Parser.prototype.getInputStream = function () {
  23921. return this.getTokenStream();
  23922. };
  23923. Parser.prototype.setInputStream = function (input) {
  23924. this.setTokenStream(input);
  23925. };
  23926. Parser.prototype.getTokenStream = function () {
  23927. return this._input;
  23928. };
  23929. // Set the token stream and reset the parser.//
  23930. Parser.prototype.setTokenStream = function (input) {
  23931. this._input = null;
  23932. this.reset();
  23933. this._input = input;
  23934. };
  23935. // Match needs to return the current input symbol, which gets put
  23936. // into the label for the associated token ref; e.g., x=ID.
  23937. //
  23938. Parser.prototype.getCurrentToken = function () {
  23939. return this._input.LT(1);
  23940. };
  23941. Parser.prototype.notifyErrorListeners = function (msg, offendingToken, err) {
  23942. offendingToken = offendingToken || null;
  23943. err = err || null;
  23944. if (offendingToken === null) {
  23945. offendingToken = this.getCurrentToken();
  23946. }
  23947. this._syntaxErrors += 1;
  23948. var line = offendingToken.line;
  23949. var column = offendingToken.column;
  23950. var listener = this.getErrorListenerDispatch();
  23951. listener.syntaxError(this, offendingToken, line, column, msg, err);
  23952. };
  23953. //
  23954. // Consume and return the {@linkplain //getCurrentToken current symbol}.
  23955. //
  23956. // <p>E.g., given the following input with {@code A} being the current
  23957. // lookahead symbol, this function moves the cursor to {@code B} and returns
  23958. // {@code A}.</p>
  23959. //
  23960. // <pre>
  23961. // A B
  23962. // ^
  23963. // </pre>
  23964. //
  23965. // If the parser is not in error recovery mode, the consumed symbol is added
  23966. // to the parse tree using {@link ParserRuleContext//addChild(Token)}, and
  23967. // {@link ParseTreeListener//visitTerminal} is called on any parse listeners.
  23968. // If the parser <em>is</em> in error recovery mode, the consumed symbol is
  23969. // added to the parse tree using
  23970. // {@link ParserRuleContext//addErrorNode(Token)}, and
  23971. // {@link ParseTreeListener//visitErrorNode} is called on any parse
  23972. // listeners.
  23973. //
  23974. Parser.prototype.consume = function () {
  23975. var o = this.getCurrentToken();
  23976. if (o.type !== Token.EOF) {
  23977. this.getInputStream().consume();
  23978. }
  23979. var hasListener = this._parseListeners !== null && this._parseListeners.length > 0;
  23980. if (this.buildParseTrees || hasListener) {
  23981. var node;
  23982. if (this._errHandler.inErrorRecoveryMode(this)) {
  23983. node = this._ctx.addErrorNode(o);
  23984. } else {
  23985. node = this._ctx.addTokenNode(o);
  23986. }
  23987. node.invokingState = this.state;
  23988. if (hasListener) {
  23989. this._parseListeners.map(function (listener) {
  23990. if (node instanceof ErrorNode || node.isErrorNode !== undefined && node.isErrorNode()) {
  23991. listener.visitErrorNode(node);
  23992. } else if (node instanceof TerminalNode) {
  23993. listener.visitTerminal(node);
  23994. }
  23995. });
  23996. }
  23997. }
  23998. return o;
  23999. };
  24000. Parser.prototype.addContextToParseTree = function () {
  24001. // add current context to parent if we have a parent
  24002. if (this._ctx.parentCtx !== null) {
  24003. this._ctx.parentCtx.addChild(this._ctx);
  24004. }
  24005. };
  24006. // Always called by generated parsers upon entry to a rule. Access field
  24007. // {@link //_ctx} get the current context.
  24008. Parser.prototype.enterRule = function (localctx, state, ruleIndex) {
  24009. this.state = state;
  24010. this._ctx = localctx;
  24011. this._ctx.start = this._input.LT(1);
  24012. if (this.buildParseTrees) {
  24013. this.addContextToParseTree();
  24014. }
  24015. if (this._parseListeners !== null) {
  24016. this.triggerEnterRuleEvent();
  24017. }
  24018. };
  24019. Parser.prototype.exitRule = function () {
  24020. this._ctx.stop = this._input.LT(-1);
  24021. // trigger event on _ctx, before it reverts to parent
  24022. if (this._parseListeners !== null) {
  24023. this.triggerExitRuleEvent();
  24024. }
  24025. this.state = this._ctx.invokingState;
  24026. this._ctx = this._ctx.parentCtx;
  24027. };
  24028. Parser.prototype.enterOuterAlt = function (localctx, altNum) {
  24029. localctx.setAltNumber(altNum);
  24030. // if we have new localctx, make sure we replace existing ctx
  24031. // that is previous child of parse tree
  24032. if (this.buildParseTrees && this._ctx !== localctx) {
  24033. if (this._ctx.parentCtx !== null) {
  24034. this._ctx.parentCtx.removeLastChild();
  24035. this._ctx.parentCtx.addChild(localctx);
  24036. }
  24037. }
  24038. this._ctx = localctx;
  24039. };
  24040. // Get the precedence level for the top-most precedence rule.
  24041. //
  24042. // @return The precedence level for the top-most precedence rule, or -1 if
  24043. // the parser context is not nested within a precedence rule.
  24044. Parser.prototype.getPrecedence = function () {
  24045. if (this._precedenceStack.length === 0) {
  24046. return -1;
  24047. } else {
  24048. return this._precedenceStack[this._precedenceStack.length - 1];
  24049. }
  24050. };
  24051. Parser.prototype.enterRecursionRule = function (localctx, state, ruleIndex, precedence) {
  24052. this.state = state;
  24053. this._precedenceStack.push(precedence);
  24054. this._ctx = localctx;
  24055. this._ctx.start = this._input.LT(1);
  24056. if (this._parseListeners !== null) {
  24057. this.triggerEnterRuleEvent(); // simulates rule entry for
  24058. // left-recursive rules
  24059. }
  24060. };
  24061. //
  24062. // Like {@link //enterRule} but for recursive rules.
  24063. Parser.prototype.pushNewRecursionContext = function (localctx, state, ruleIndex) {
  24064. var previous = this._ctx;
  24065. previous.parentCtx = localctx;
  24066. previous.invokingState = state;
  24067. previous.stop = this._input.LT(-1);
  24068. this._ctx = localctx;
  24069. this._ctx.start = previous.start;
  24070. if (this.buildParseTrees) {
  24071. this._ctx.addChild(previous);
  24072. }
  24073. if (this._parseListeners !== null) {
  24074. this.triggerEnterRuleEvent(); // simulates rule entry for
  24075. // left-recursive rules
  24076. }
  24077. };
  24078. Parser.prototype.unrollRecursionContexts = function (parentCtx) {
  24079. this._precedenceStack.pop();
  24080. this._ctx.stop = this._input.LT(-1);
  24081. var retCtx = this._ctx; // save current ctx (return value)
  24082. // unroll so _ctx is as it was before call to recursive method
  24083. if (this._parseListeners !== null) {
  24084. while (this._ctx !== parentCtx) {
  24085. this.triggerExitRuleEvent();
  24086. this._ctx = this._ctx.parentCtx;
  24087. }
  24088. } else {
  24089. this._ctx = parentCtx;
  24090. }
  24091. // hook into tree
  24092. retCtx.parentCtx = parentCtx;
  24093. if (this.buildParseTrees && parentCtx !== null) {
  24094. // add return ctx into invoking rule's tree
  24095. parentCtx.addChild(retCtx);
  24096. }
  24097. };
  24098. Parser.prototype.getInvokingContext = function (ruleIndex) {
  24099. var ctx = this._ctx;
  24100. while (ctx !== null) {
  24101. if (ctx.ruleIndex === ruleIndex) {
  24102. return ctx;
  24103. }
  24104. ctx = ctx.parentCtx;
  24105. }
  24106. return null;
  24107. };
  24108. Parser.prototype.precpred = function (localctx, precedence) {
  24109. return precedence >= this._precedenceStack[this._precedenceStack.length - 1];
  24110. };
  24111. Parser.prototype.inContext = function (context) {
  24112. // TODO: useful in parser?
  24113. return false;
  24114. };
  24115. //
  24116. // Checks whether or not {@code symbol} can follow the current state in the
  24117. // ATN. The behavior of this method is equivalent to the following, but is
  24118. // implemented such that the complete context-sensitive follow set does not
  24119. // need to be explicitly constructed.
  24120. //
  24121. // <pre>
  24122. // return getExpectedTokens().contains(symbol);
  24123. // </pre>
  24124. //
  24125. // @param symbol the symbol type to check
  24126. // @return {@code true} if {@code symbol} can follow the current state in
  24127. // the ATN, otherwise {@code false}.
  24128. Parser.prototype.isExpectedToken = function (symbol) {
  24129. var atn = this._interp.atn;
  24130. var ctx = this._ctx;
  24131. var s = atn.states[this.state];
  24132. var following = atn.nextTokens(s);
  24133. if (following.contains(symbol)) {
  24134. return true;
  24135. }
  24136. if (!following.contains(Token.EPSILON)) {
  24137. return false;
  24138. }
  24139. while (ctx !== null && ctx.invokingState >= 0 && following.contains(Token.EPSILON)) {
  24140. var invokingState = atn.states[ctx.invokingState];
  24141. var rt = invokingState.transitions[0];
  24142. following = atn.nextTokens(rt.followState);
  24143. if (following.contains(symbol)) {
  24144. return true;
  24145. }
  24146. ctx = ctx.parentCtx;
  24147. }
  24148. if (following.contains(Token.EPSILON) && symbol === Token.EOF) {
  24149. return true;
  24150. } else {
  24151. return false;
  24152. }
  24153. };
  24154. // Computes the set of input symbols which could follow the current parser
  24155. // state and context, as given by {@link //getState} and {@link //getContext},
  24156. // respectively.
  24157. //
  24158. // @see ATN//getExpectedTokens(int, RuleContext)
  24159. //
  24160. Parser.prototype.getExpectedTokens = function () {
  24161. return this._interp.atn.getExpectedTokens(this.state, this._ctx);
  24162. };
  24163. Parser.prototype.getExpectedTokensWithinCurrentRule = function () {
  24164. var atn = this._interp.atn;
  24165. var s = atn.states[this.state];
  24166. return atn.nextTokens(s);
  24167. };
  24168. // Get a rule's index (i.e., {@code RULE_ruleName} field) or -1 if not found.//
  24169. Parser.prototype.getRuleIndex = function (ruleName) {
  24170. var ruleIndex = this.getRuleIndexMap()[ruleName];
  24171. if (ruleIndex !== null) {
  24172. return ruleIndex;
  24173. } else {
  24174. return -1;
  24175. }
  24176. };
  24177. // Return List&lt;String&gt; of the rule names in your parser instance
  24178. // leading up to a call to the current rule. You could override if
  24179. // you want more details such as the file/line info of where
  24180. // in the ATN a rule is invoked.
  24181. //
  24182. // this is very useful for error messages.
  24183. //
  24184. Parser.prototype.getRuleInvocationStack = function (p) {
  24185. p = p || null;
  24186. if (p === null) {
  24187. p = this._ctx;
  24188. }
  24189. var stack = [];
  24190. while (p !== null) {
  24191. // compute what follows who invoked us
  24192. var ruleIndex = p.ruleIndex;
  24193. if (ruleIndex < 0) {
  24194. stack.push("n/a");
  24195. } else {
  24196. stack.push(this.ruleNames[ruleIndex]);
  24197. }
  24198. p = p.parentCtx;
  24199. }
  24200. return stack;
  24201. };
  24202. // For debugging and other purposes.//
  24203. Parser.prototype.getDFAStrings = function () {
  24204. return this._interp.decisionToDFA.toString();
  24205. };
  24206. // For debugging and other purposes.//
  24207. Parser.prototype.dumpDFA = function () {
  24208. var seenOne = false;
  24209. for (var i = 0; i < this._interp.decisionToDFA.length; i++) {
  24210. var dfa = this._interp.decisionToDFA[i];
  24211. if (dfa.states.length > 0) {
  24212. if (seenOne) {
  24213. console.log();
  24214. }
  24215. this.printer.println("Decision " + dfa.decision + ":");
  24216. this.printer.print(dfa.toString(this.literalNames, this.symbolicNames));
  24217. seenOne = true;
  24218. }
  24219. }
  24220. };
  24221. /*
  24222. " printer = function() {\r\n" +
  24223. " this.println = function(s) { document.getElementById('output') += s + '\\n'; }\r\n" +
  24224. " this.print = function(s) { document.getElementById('output') += s; }\r\n" +
  24225. " };\r\n" +
  24226. */
  24227. Parser.prototype.getSourceName = function () {
  24228. return this._input.sourceName;
  24229. };
  24230. // During a parse is sometimes useful to listen in on the rule entry and exit
  24231. // events as well as token matches. this is for quick and dirty debugging.
  24232. //
  24233. Parser.prototype.setTrace = function (trace) {
  24234. if (!trace) {
  24235. this.removeParseListener(this._tracer);
  24236. this._tracer = null;
  24237. } else {
  24238. if (this._tracer !== null) {
  24239. this.removeParseListener(this._tracer);
  24240. }
  24241. this._tracer = new TraceListener(this);
  24242. this.addParseListener(this._tracer);
  24243. }
  24244. };
  24245. exports.Parser = Parser;
  24246. /***/ }),
  24247. /***/ "./node_modules/antlr4/ParserRuleContext.js":
  24248. /*!**************************************************!*\
  24249. !*** ./node_modules/antlr4/ParserRuleContext.js ***!
  24250. \**************************************************/
  24251. /*! no static exports found */
  24252. /***/ (function(module, exports, __webpack_require__) {
  24253. "use strict";
  24254. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  24255. * Use of this file is governed by the BSD 3-clause license that
  24256. * can be found in the LICENSE.txt file in the project root.
  24257. */
  24258. //* A rule invocation record for parsing.
  24259. //
  24260. // Contains all of the information about the current rule not stored in the
  24261. // RuleContext. It handles parse tree children list, Any ATN state
  24262. // tracing, and the default values available for rule indications:
  24263. // start, stop, rule index, current alt number, current
  24264. // ATN state.
  24265. //
  24266. // Subclasses made for each rule and grammar track the parameters,
  24267. // return values, locals, and labels specific to that rule. These
  24268. // are the objects that are returned from rules.
  24269. //
  24270. // Note text is not an actual field of a rule return value; it is computed
  24271. // from start and stop using the input stream's toString() method. I
  24272. // could add a ctor to this so that we can pass in and store the input
  24273. // stream, but I'm not sure we want to do that. It would seem to be undefined
  24274. // to get the .text property anyway if the rule matches tokens from multiple
  24275. // input streams.
  24276. //
  24277. // I do not use getters for fields of objects that are used simply to
  24278. // group values such as this aggregate. The getters/setters are there to
  24279. // satisfy the superclass interface.
  24280. var RuleContext = __webpack_require__(/*! ./RuleContext */ "./node_modules/antlr4/RuleContext.js").RuleContext;
  24281. var Tree = __webpack_require__(/*! ./tree/Tree */ "./node_modules/antlr4/tree/Tree.js");
  24282. var INVALID_INTERVAL = Tree.INVALID_INTERVAL;
  24283. var TerminalNode = Tree.TerminalNode;
  24284. var TerminalNodeImpl = Tree.TerminalNodeImpl;
  24285. var ErrorNodeImpl = Tree.ErrorNodeImpl;
  24286. var Interval = __webpack_require__(/*! ./IntervalSet */ "./node_modules/antlr4/IntervalSet.js").Interval;
  24287. function ParserRuleContext(parent, invokingStateNumber) {
  24288. parent = parent || null;
  24289. invokingStateNumber = invokingStateNumber || null;
  24290. RuleContext.call(this, parent, invokingStateNumber);
  24291. this.ruleIndex = -1;
  24292. // * If we are debugging or building a parse tree for a visitor,
  24293. // we need to track all of the tokens and rule invocations associated
  24294. // with this rule's context. This is empty for parsing w/o tree constr.
  24295. // operation because we don't the need to track the details about
  24296. // how we parse this rule.
  24297. // /
  24298. this.children = null;
  24299. this.start = null;
  24300. this.stop = null;
  24301. // The exception that forced this rule to return. If the rule successfully
  24302. // completed, this is {@code null}.
  24303. this.exception = null;
  24304. }
  24305. ParserRuleContext.prototype = Object.create(RuleContext.prototype);
  24306. ParserRuleContext.prototype.constructor = ParserRuleContext;
  24307. // * COPY a ctx (I'm deliberately not using copy constructor)///
  24308. ParserRuleContext.prototype.copyFrom = function (ctx) {
  24309. // from RuleContext
  24310. this.parentCtx = ctx.parentCtx;
  24311. this.invokingState = ctx.invokingState;
  24312. this.children = null;
  24313. this.start = ctx.start;
  24314. this.stop = ctx.stop;
  24315. // copy any error nodes to alt label node
  24316. if (ctx.children) {
  24317. this.children = [];
  24318. // reset parent pointer for any error nodes
  24319. ctx.children.map(function (child) {
  24320. if (child instanceof ErrorNodeImpl) {
  24321. this.children.push(child);
  24322. child.parentCtx = this;
  24323. }
  24324. }, this);
  24325. }
  24326. };
  24327. // Double dispatch methods for listeners
  24328. ParserRuleContext.prototype.enterRule = function (listener) {};
  24329. ParserRuleContext.prototype.exitRule = function (listener) {};
  24330. // * Does not set parent link; other add methods do that///
  24331. ParserRuleContext.prototype.addChild = function (child) {
  24332. if (this.children === null) {
  24333. this.children = [];
  24334. }
  24335. this.children.push(child);
  24336. return child;
  24337. };
  24338. // * Used by enterOuterAlt to toss out a RuleContext previously added as
  24339. // we entered a rule. If we have // label, we will need to remove
  24340. // generic ruleContext object.
  24341. // /
  24342. ParserRuleContext.prototype.removeLastChild = function () {
  24343. if (this.children !== null) {
  24344. this.children.pop();
  24345. }
  24346. };
  24347. ParserRuleContext.prototype.addTokenNode = function (token) {
  24348. var node = new TerminalNodeImpl(token);
  24349. this.addChild(node);
  24350. node.parentCtx = this;
  24351. return node;
  24352. };
  24353. ParserRuleContext.prototype.addErrorNode = function (badToken) {
  24354. var node = new ErrorNodeImpl(badToken);
  24355. this.addChild(node);
  24356. node.parentCtx = this;
  24357. return node;
  24358. };
  24359. ParserRuleContext.prototype.getChild = function (i, type) {
  24360. type = type || null;
  24361. if (this.children === null || i < 0 || i >= this.children.length) {
  24362. return null;
  24363. }
  24364. if (type === null) {
  24365. return this.children[i];
  24366. } else {
  24367. for (var j = 0; j < this.children.length; j++) {
  24368. var child = this.children[j];
  24369. if (child instanceof type) {
  24370. if (i === 0) {
  24371. return child;
  24372. } else {
  24373. i -= 1;
  24374. }
  24375. }
  24376. }
  24377. return null;
  24378. }
  24379. };
  24380. ParserRuleContext.prototype.getToken = function (ttype, i) {
  24381. if (this.children === null || i < 0 || i >= this.children.length) {
  24382. return null;
  24383. }
  24384. for (var j = 0; j < this.children.length; j++) {
  24385. var child = this.children[j];
  24386. if (child instanceof TerminalNode) {
  24387. if (child.symbol.type === ttype) {
  24388. if (i === 0) {
  24389. return child;
  24390. } else {
  24391. i -= 1;
  24392. }
  24393. }
  24394. }
  24395. }
  24396. return null;
  24397. };
  24398. ParserRuleContext.prototype.getTokens = function (ttype) {
  24399. if (this.children === null) {
  24400. return [];
  24401. } else {
  24402. var tokens = [];
  24403. for (var j = 0; j < this.children.length; j++) {
  24404. var child = this.children[j];
  24405. if (child instanceof TerminalNode) {
  24406. if (child.symbol.type === ttype) {
  24407. tokens.push(child);
  24408. }
  24409. }
  24410. }
  24411. return tokens;
  24412. }
  24413. };
  24414. ParserRuleContext.prototype.getTypedRuleContext = function (ctxType, i) {
  24415. return this.getChild(i, ctxType);
  24416. };
  24417. ParserRuleContext.prototype.getTypedRuleContexts = function (ctxType) {
  24418. if (this.children === null) {
  24419. return [];
  24420. } else {
  24421. var contexts = [];
  24422. for (var j = 0; j < this.children.length; j++) {
  24423. var child = this.children[j];
  24424. if (child instanceof ctxType) {
  24425. contexts.push(child);
  24426. }
  24427. }
  24428. return contexts;
  24429. }
  24430. };
  24431. ParserRuleContext.prototype.getChildCount = function () {
  24432. if (this.children === null) {
  24433. return 0;
  24434. } else {
  24435. return this.children.length;
  24436. }
  24437. };
  24438. ParserRuleContext.prototype.getSourceInterval = function () {
  24439. if (this.start === null || this.stop === null) {
  24440. return INVALID_INTERVAL;
  24441. } else {
  24442. return new Interval(this.start.tokenIndex, this.stop.tokenIndex);
  24443. }
  24444. };
  24445. RuleContext.EMPTY = new ParserRuleContext();
  24446. function InterpreterRuleContext(parent, invokingStateNumber, ruleIndex) {
  24447. ParserRuleContext.call(parent, invokingStateNumber);
  24448. this.ruleIndex = ruleIndex;
  24449. return this;
  24450. }
  24451. InterpreterRuleContext.prototype = Object.create(ParserRuleContext.prototype);
  24452. InterpreterRuleContext.prototype.constructor = InterpreterRuleContext;
  24453. exports.ParserRuleContext = ParserRuleContext;
  24454. /***/ }),
  24455. /***/ "./node_modules/antlr4/PredictionContext.js":
  24456. /*!**************************************************!*\
  24457. !*** ./node_modules/antlr4/PredictionContext.js ***!
  24458. \**************************************************/
  24459. /*! no static exports found */
  24460. /***/ (function(module, exports, __webpack_require__) {
  24461. "use strict";
  24462. //
  24463. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  24464. * Use of this file is governed by the BSD 3-clause license that
  24465. * can be found in the LICENSE.txt file in the project root.
  24466. */
  24467. ///
  24468. var RuleContext = __webpack_require__(/*! ./RuleContext */ "./node_modules/antlr4/RuleContext.js").RuleContext;
  24469. var Hash = __webpack_require__(/*! ./Utils */ "./node_modules/antlr4/Utils.js").Hash;
  24470. function PredictionContext(cachedHashCode) {
  24471. this.cachedHashCode = cachedHashCode;
  24472. }
  24473. // Represents {@code $} in local context prediction, which means wildcard.
  24474. // {@code//+x =//}.
  24475. // /
  24476. PredictionContext.EMPTY = null;
  24477. // Represents {@code $} in an array in full context mode, when {@code $}
  24478. // doesn't mean wildcard: {@code $ + x = [$,x]}. Here,
  24479. // {@code $} = {@link //EMPTY_RETURN_STATE}.
  24480. // /
  24481. PredictionContext.EMPTY_RETURN_STATE = 0x7FFFFFFF;
  24482. PredictionContext.globalNodeCount = 1;
  24483. PredictionContext.id = PredictionContext.globalNodeCount;
  24484. // Stores the computed hash code of this {@link PredictionContext}. The hash
  24485. // code is computed in parts to match the following reference algorithm.
  24486. //
  24487. // <pre>
  24488. // private int referenceHashCode() {
  24489. // int hash = {@link MurmurHash//initialize MurmurHash.initialize}({@link
  24490. // //INITIAL_HASH});
  24491. //
  24492. // for (int i = 0; i &lt; {@link //size()}; i++) {
  24493. // hash = {@link MurmurHash//update MurmurHash.update}(hash, {@link //getParent
  24494. // getParent}(i));
  24495. // }
  24496. //
  24497. // for (int i = 0; i &lt; {@link //size()}; i++) {
  24498. // hash = {@link MurmurHash//update MurmurHash.update}(hash, {@link
  24499. // //getReturnState getReturnState}(i));
  24500. // }
  24501. //
  24502. // hash = {@link MurmurHash//finish MurmurHash.finish}(hash, 2// {@link
  24503. // //size()});
  24504. // return hash;
  24505. // }
  24506. // </pre>
  24507. // /
  24508. // This means only the {@link //EMPTY} context is in set.
  24509. PredictionContext.prototype.isEmpty = function () {
  24510. return this === PredictionContext.EMPTY;
  24511. };
  24512. PredictionContext.prototype.hasEmptyPath = function () {
  24513. return this.getReturnState(this.length - 1) === PredictionContext.EMPTY_RETURN_STATE;
  24514. };
  24515. PredictionContext.prototype.hashCode = function () {
  24516. return this.cachedHashCode;
  24517. };
  24518. PredictionContext.prototype.updateHashCode = function (hash) {
  24519. hash.update(this.cachedHashCode);
  24520. };
  24521. /*
  24522. function calculateHashString(parent, returnState) {
  24523. return "" + parent + returnState;
  24524. }
  24525. */
  24526. // Used to cache {@link PredictionContext} objects. Its used for the shared
  24527. // context cash associated with contexts in DFA states. This cache
  24528. // can be used for both lexers and parsers.
  24529. function PredictionContextCache() {
  24530. this.cache = {};
  24531. return this;
  24532. }
  24533. // Add a context to the cache and return it. If the context already exists,
  24534. // return that one instead and do not add a new context to the cache.
  24535. // Protect shared cache from unsafe thread access.
  24536. //
  24537. PredictionContextCache.prototype.add = function (ctx) {
  24538. if (ctx === PredictionContext.EMPTY) {
  24539. return PredictionContext.EMPTY;
  24540. }
  24541. var existing = this.cache[ctx] || null;
  24542. if (existing !== null) {
  24543. return existing;
  24544. }
  24545. this.cache[ctx] = ctx;
  24546. return ctx;
  24547. };
  24548. PredictionContextCache.prototype.get = function (ctx) {
  24549. return this.cache[ctx] || null;
  24550. };
  24551. Object.defineProperty(PredictionContextCache.prototype, "length", {
  24552. get: function get() {
  24553. return this.cache.length;
  24554. }
  24555. });
  24556. function SingletonPredictionContext(parent, returnState) {
  24557. var hashCode = 0;
  24558. if (parent !== null) {
  24559. var hash = new Hash();
  24560. hash.update(parent, returnState);
  24561. hashCode = hash.finish();
  24562. }
  24563. PredictionContext.call(this, hashCode);
  24564. this.parentCtx = parent;
  24565. this.returnState = returnState;
  24566. }
  24567. SingletonPredictionContext.prototype = Object.create(PredictionContext.prototype);
  24568. SingletonPredictionContext.prototype.contructor = SingletonPredictionContext;
  24569. SingletonPredictionContext.create = function (parent, returnState) {
  24570. if (returnState === PredictionContext.EMPTY_RETURN_STATE && parent === null) {
  24571. // someone can pass in the bits of an array ctx that mean $
  24572. return PredictionContext.EMPTY;
  24573. } else {
  24574. return new SingletonPredictionContext(parent, returnState);
  24575. }
  24576. };
  24577. Object.defineProperty(SingletonPredictionContext.prototype, "length", {
  24578. get: function get() {
  24579. return 1;
  24580. }
  24581. });
  24582. SingletonPredictionContext.prototype.getParent = function (index) {
  24583. return this.parentCtx;
  24584. };
  24585. SingletonPredictionContext.prototype.getReturnState = function (index) {
  24586. return this.returnState;
  24587. };
  24588. SingletonPredictionContext.prototype.equals = function (other) {
  24589. if (this === other) {
  24590. return true;
  24591. } else if (!(other instanceof SingletonPredictionContext)) {
  24592. return false;
  24593. } else if (this.hashCode() !== other.hashCode()) {
  24594. return false; // can't be same if hash is different
  24595. } else {
  24596. if (this.returnState !== other.returnState) return false;else if (this.parentCtx == null) return other.parentCtx == null;else return this.parentCtx.equals(other.parentCtx);
  24597. }
  24598. };
  24599. SingletonPredictionContext.prototype.toString = function () {
  24600. var up = this.parentCtx === null ? "" : this.parentCtx.toString();
  24601. if (up.length === 0) {
  24602. if (this.returnState === PredictionContext.EMPTY_RETURN_STATE) {
  24603. return "$";
  24604. } else {
  24605. return "" + this.returnState;
  24606. }
  24607. } else {
  24608. return "" + this.returnState + " " + up;
  24609. }
  24610. };
  24611. function EmptyPredictionContext() {
  24612. SingletonPredictionContext.call(this, null, PredictionContext.EMPTY_RETURN_STATE);
  24613. return this;
  24614. }
  24615. EmptyPredictionContext.prototype = Object.create(SingletonPredictionContext.prototype);
  24616. EmptyPredictionContext.prototype.constructor = EmptyPredictionContext;
  24617. EmptyPredictionContext.prototype.isEmpty = function () {
  24618. return true;
  24619. };
  24620. EmptyPredictionContext.prototype.getParent = function (index) {
  24621. return null;
  24622. };
  24623. EmptyPredictionContext.prototype.getReturnState = function (index) {
  24624. return this.returnState;
  24625. };
  24626. EmptyPredictionContext.prototype.equals = function (other) {
  24627. return this === other;
  24628. };
  24629. EmptyPredictionContext.prototype.toString = function () {
  24630. return "$";
  24631. };
  24632. PredictionContext.EMPTY = new EmptyPredictionContext();
  24633. function ArrayPredictionContext(parents, returnStates) {
  24634. // Parent can be null only if full ctx mode and we make an array
  24635. // from {@link //EMPTY} and non-empty. We merge {@link //EMPTY} by using
  24636. // null parent and
  24637. // returnState == {@link //EMPTY_RETURN_STATE}.
  24638. var h = new Hash();
  24639. h.update(parents, returnStates);
  24640. var hashCode = h.finish();
  24641. PredictionContext.call(this, hashCode);
  24642. this.parents = parents;
  24643. this.returnStates = returnStates;
  24644. return this;
  24645. }
  24646. ArrayPredictionContext.prototype = Object.create(PredictionContext.prototype);
  24647. ArrayPredictionContext.prototype.constructor = ArrayPredictionContext;
  24648. ArrayPredictionContext.prototype.isEmpty = function () {
  24649. // since EMPTY_RETURN_STATE can only appear in the last position, we
  24650. // don't need to verify that size==1
  24651. return this.returnStates[0] === PredictionContext.EMPTY_RETURN_STATE;
  24652. };
  24653. Object.defineProperty(ArrayPredictionContext.prototype, "length", {
  24654. get: function get() {
  24655. return this.returnStates.length;
  24656. }
  24657. });
  24658. ArrayPredictionContext.prototype.getParent = function (index) {
  24659. return this.parents[index];
  24660. };
  24661. ArrayPredictionContext.prototype.getReturnState = function (index) {
  24662. return this.returnStates[index];
  24663. };
  24664. ArrayPredictionContext.prototype.equals = function (other) {
  24665. if (this === other) {
  24666. return true;
  24667. } else if (!(other instanceof ArrayPredictionContext)) {
  24668. return false;
  24669. } else if (this.hashCode() !== other.hashCode()) {
  24670. return false; // can't be same if hash is different
  24671. } else {
  24672. return this.returnStates === other.returnStates && this.parents === other.parents;
  24673. }
  24674. };
  24675. ArrayPredictionContext.prototype.toString = function () {
  24676. if (this.isEmpty()) {
  24677. return "[]";
  24678. } else {
  24679. var s = "[";
  24680. for (var i = 0; i < this.returnStates.length; i++) {
  24681. if (i > 0) {
  24682. s = s + ", ";
  24683. }
  24684. if (this.returnStates[i] === PredictionContext.EMPTY_RETURN_STATE) {
  24685. s = s + "$";
  24686. continue;
  24687. }
  24688. s = s + this.returnStates[i];
  24689. if (this.parents[i] !== null) {
  24690. s = s + " " + this.parents[i];
  24691. } else {
  24692. s = s + "null";
  24693. }
  24694. }
  24695. return s + "]";
  24696. }
  24697. };
  24698. // Convert a {@link RuleContext} tree to a {@link PredictionContext} graph.
  24699. // Return {@link //EMPTY} if {@code outerContext} is empty or null.
  24700. // /
  24701. function predictionContextFromRuleContext(atn, outerContext) {
  24702. if (outerContext === undefined || outerContext === null) {
  24703. outerContext = RuleContext.EMPTY;
  24704. }
  24705. // if we are in RuleContext of start rule, s, then PredictionContext
  24706. // is EMPTY. Nobody called us. (if we are empty, return empty)
  24707. if (outerContext.parentCtx === null || outerContext === RuleContext.EMPTY) {
  24708. return PredictionContext.EMPTY;
  24709. }
  24710. // If we have a parent, convert it to a PredictionContext graph
  24711. var parent = predictionContextFromRuleContext(atn, outerContext.parentCtx);
  24712. var state = atn.states[outerContext.invokingState];
  24713. var transition = state.transitions[0];
  24714. return SingletonPredictionContext.create(parent, transition.followState.stateNumber);
  24715. }
  24716. /*
  24717. function calculateListsHashString(parents, returnStates) {
  24718. var s = "";
  24719. parents.map(function(p) {
  24720. s = s + p;
  24721. });
  24722. returnStates.map(function(r) {
  24723. s = s + r;
  24724. });
  24725. return s;
  24726. }
  24727. */
  24728. function merge(a, b, rootIsWildcard, mergeCache) {
  24729. // share same graph if both same
  24730. if (a === b) {
  24731. return a;
  24732. }
  24733. if (a instanceof SingletonPredictionContext && b instanceof SingletonPredictionContext) {
  24734. return mergeSingletons(a, b, rootIsWildcard, mergeCache);
  24735. }
  24736. // At least one of a or b is array
  24737. // If one is $ and rootIsWildcard, return $ as// wildcard
  24738. if (rootIsWildcard) {
  24739. if (a instanceof EmptyPredictionContext) {
  24740. return a;
  24741. }
  24742. if (b instanceof EmptyPredictionContext) {
  24743. return b;
  24744. }
  24745. }
  24746. // convert singleton so both are arrays to normalize
  24747. if (a instanceof SingletonPredictionContext) {
  24748. a = new ArrayPredictionContext([a.getParent()], [a.returnState]);
  24749. }
  24750. if (b instanceof SingletonPredictionContext) {
  24751. b = new ArrayPredictionContext([b.getParent()], [b.returnState]);
  24752. }
  24753. return mergeArrays(a, b, rootIsWildcard, mergeCache);
  24754. }
  24755. //
  24756. // Merge two {@link SingletonPredictionContext} instances.
  24757. //
  24758. // <p>Stack tops equal, parents merge is same; return left graph.<br>
  24759. // <embed src="images/SingletonMerge_SameRootSamePar.svg"
  24760. // type="image/svg+xml"/></p>
  24761. //
  24762. // <p>Same stack top, parents differ; merge parents giving array node, then
  24763. // remainders of those graphs. A new root node is created to point to the
  24764. // merged parents.<br>
  24765. // <embed src="images/SingletonMerge_SameRootDiffPar.svg"
  24766. // type="image/svg+xml"/></p>
  24767. //
  24768. // <p>Different stack tops pointing to same parent. Make array node for the
  24769. // root where both element in the root point to the same (original)
  24770. // parent.<br>
  24771. // <embed src="images/SingletonMerge_DiffRootSamePar.svg"
  24772. // type="image/svg+xml"/></p>
  24773. //
  24774. // <p>Different stack tops pointing to different parents. Make array node for
  24775. // the root where each element points to the corresponding original
  24776. // parent.<br>
  24777. // <embed src="images/SingletonMerge_DiffRootDiffPar.svg"
  24778. // type="image/svg+xml"/></p>
  24779. //
  24780. // @param a the first {@link SingletonPredictionContext}
  24781. // @param b the second {@link SingletonPredictionContext}
  24782. // @param rootIsWildcard {@code true} if this is a local-context merge,
  24783. // otherwise false to indicate a full-context merge
  24784. // @param mergeCache
  24785. // /
  24786. function mergeSingletons(a, b, rootIsWildcard, mergeCache) {
  24787. if (mergeCache !== null) {
  24788. var previous = mergeCache.get(a, b);
  24789. if (previous !== null) {
  24790. return previous;
  24791. }
  24792. previous = mergeCache.get(b, a);
  24793. if (previous !== null) {
  24794. return previous;
  24795. }
  24796. }
  24797. var rootMerge = mergeRoot(a, b, rootIsWildcard);
  24798. if (rootMerge !== null) {
  24799. if (mergeCache !== null) {
  24800. mergeCache.set(a, b, rootMerge);
  24801. }
  24802. return rootMerge;
  24803. }
  24804. if (a.returnState === b.returnState) {
  24805. var parent = merge(a.parentCtx, b.parentCtx, rootIsWildcard, mergeCache);
  24806. // if parent is same as existing a or b parent or reduced to a parent,
  24807. // return it
  24808. if (parent === a.parentCtx) {
  24809. return a; // ax + bx = ax, if a=b
  24810. }
  24811. if (parent === b.parentCtx) {
  24812. return b; // ax + bx = bx, if a=b
  24813. }
  24814. // else: ax + ay = a'[x,y]
  24815. // merge parents x and y, giving array node with x,y then remainders
  24816. // of those graphs. dup a, a' points at merged array
  24817. // new joined parent so create new singleton pointing to it, a'
  24818. var spc = SingletonPredictionContext.create(parent, a.returnState);
  24819. if (mergeCache !== null) {
  24820. mergeCache.set(a, b, spc);
  24821. }
  24822. return spc;
  24823. } else {
  24824. // a != b payloads differ
  24825. // see if we can collapse parents due to $+x parents if local ctx
  24826. var singleParent = null;
  24827. if (a === b || a.parentCtx !== null && a.parentCtx === b.parentCtx) {
  24828. // ax +
  24829. // bx =
  24830. // [a,b]x
  24831. singleParent = a.parentCtx;
  24832. }
  24833. if (singleParent !== null) {
  24834. // parents are same
  24835. // sort payloads and use same parent
  24836. var payloads = [a.returnState, b.returnState];
  24837. if (a.returnState > b.returnState) {
  24838. payloads[0] = b.returnState;
  24839. payloads[1] = a.returnState;
  24840. }
  24841. var parents = [singleParent, singleParent];
  24842. var apc = new ArrayPredictionContext(parents, payloads);
  24843. if (mergeCache !== null) {
  24844. mergeCache.set(a, b, apc);
  24845. }
  24846. return apc;
  24847. }
  24848. // parents differ and can't merge them. Just pack together
  24849. // into array; can't merge.
  24850. // ax + by = [ax,by]
  24851. var payloads = [a.returnState, b.returnState];
  24852. var parents = [a.parentCtx, b.parentCtx];
  24853. if (a.returnState > b.returnState) {
  24854. // sort by payload
  24855. payloads[0] = b.returnState;
  24856. payloads[1] = a.returnState;
  24857. parents = [b.parentCtx, a.parentCtx];
  24858. }
  24859. var a_ = new ArrayPredictionContext(parents, payloads);
  24860. if (mergeCache !== null) {
  24861. mergeCache.set(a, b, a_);
  24862. }
  24863. return a_;
  24864. }
  24865. }
  24866. //
  24867. // Handle case where at least one of {@code a} or {@code b} is
  24868. // {@link //EMPTY}. In the following diagrams, the symbol {@code $} is used
  24869. // to represent {@link //EMPTY}.
  24870. //
  24871. // <h2>Local-Context Merges</h2>
  24872. //
  24873. // <p>These local-context merge operations are used when {@code rootIsWildcard}
  24874. // is true.</p>
  24875. //
  24876. // <p>{@link //EMPTY} is superset of any graph; return {@link //EMPTY}.<br>
  24877. // <embed src="images/LocalMerge_EmptyRoot.svg" type="image/svg+xml"/></p>
  24878. //
  24879. // <p>{@link //EMPTY} and anything is {@code //EMPTY}, so merged parent is
  24880. // {@code //EMPTY}; return left graph.<br>
  24881. // <embed src="images/LocalMerge_EmptyParent.svg" type="image/svg+xml"/></p>
  24882. //
  24883. // <p>Special case of last merge if local context.<br>
  24884. // <embed src="images/LocalMerge_DiffRoots.svg" type="image/svg+xml"/></p>
  24885. //
  24886. // <h2>Full-Context Merges</h2>
  24887. //
  24888. // <p>These full-context merge operations are used when {@code rootIsWildcard}
  24889. // is false.</p>
  24890. //
  24891. // <p><embed src="images/FullMerge_EmptyRoots.svg" type="image/svg+xml"/></p>
  24892. //
  24893. // <p>Must keep all contexts; {@link //EMPTY} in array is a special value (and
  24894. // null parent).<br>
  24895. // <embed src="images/FullMerge_EmptyRoot.svg" type="image/svg+xml"/></p>
  24896. //
  24897. // <p><embed src="images/FullMerge_SameRoot.svg" type="image/svg+xml"/></p>
  24898. //
  24899. // @param a the first {@link SingletonPredictionContext}
  24900. // @param b the second {@link SingletonPredictionContext}
  24901. // @param rootIsWildcard {@code true} if this is a local-context merge,
  24902. // otherwise false to indicate a full-context merge
  24903. // /
  24904. function mergeRoot(a, b, rootIsWildcard) {
  24905. if (rootIsWildcard) {
  24906. if (a === PredictionContext.EMPTY) {
  24907. return PredictionContext.EMPTY; // // + b =//
  24908. }
  24909. if (b === PredictionContext.EMPTY) {
  24910. return PredictionContext.EMPTY; // a +// =//
  24911. }
  24912. } else {
  24913. if (a === PredictionContext.EMPTY && b === PredictionContext.EMPTY) {
  24914. return PredictionContext.EMPTY; // $ + $ = $
  24915. } else if (a === PredictionContext.EMPTY) {
  24916. // $ + x = [$,x]
  24917. var payloads = [b.returnState, PredictionContext.EMPTY_RETURN_STATE];
  24918. var parents = [b.parentCtx, null];
  24919. return new ArrayPredictionContext(parents, payloads);
  24920. } else if (b === PredictionContext.EMPTY) {
  24921. // x + $ = [$,x] ($ is always first if present)
  24922. var payloads = [a.returnState, PredictionContext.EMPTY_RETURN_STATE];
  24923. var parents = [a.parentCtx, null];
  24924. return new ArrayPredictionContext(parents, payloads);
  24925. }
  24926. }
  24927. return null;
  24928. }
  24929. //
  24930. // Merge two {@link ArrayPredictionContext} instances.
  24931. //
  24932. // <p>Different tops, different parents.<br>
  24933. // <embed src="images/ArrayMerge_DiffTopDiffPar.svg" type="image/svg+xml"/></p>
  24934. //
  24935. // <p>Shared top, same parents.<br>
  24936. // <embed src="images/ArrayMerge_ShareTopSamePar.svg" type="image/svg+xml"/></p>
  24937. //
  24938. // <p>Shared top, different parents.<br>
  24939. // <embed src="images/ArrayMerge_ShareTopDiffPar.svg" type="image/svg+xml"/></p>
  24940. //
  24941. // <p>Shared top, all shared parents.<br>
  24942. // <embed src="images/ArrayMerge_ShareTopSharePar.svg"
  24943. // type="image/svg+xml"/></p>
  24944. //
  24945. // <p>Equal tops, merge parents and reduce top to
  24946. // {@link SingletonPredictionContext}.<br>
  24947. // <embed src="images/ArrayMerge_EqualTop.svg" type="image/svg+xml"/></p>
  24948. // /
  24949. function mergeArrays(a, b, rootIsWildcard, mergeCache) {
  24950. if (mergeCache !== null) {
  24951. var previous = mergeCache.get(a, b);
  24952. if (previous !== null) {
  24953. return previous;
  24954. }
  24955. previous = mergeCache.get(b, a);
  24956. if (previous !== null) {
  24957. return previous;
  24958. }
  24959. }
  24960. // merge sorted payloads a + b => M
  24961. var i = 0; // walks a
  24962. var j = 0; // walks b
  24963. var k = 0; // walks target M array
  24964. var mergedReturnStates = [];
  24965. var mergedParents = [];
  24966. // walk and merge to yield mergedParents, mergedReturnStates
  24967. while (i < a.returnStates.length && j < b.returnStates.length) {
  24968. var a_parent = a.parents[i];
  24969. var b_parent = b.parents[j];
  24970. if (a.returnStates[i] === b.returnStates[j]) {
  24971. // same payload (stack tops are equal), must yield merged singleton
  24972. var payload = a.returnStates[i];
  24973. // $+$ = $
  24974. var bothDollars = payload === PredictionContext.EMPTY_RETURN_STATE && a_parent === null && b_parent === null;
  24975. var ax_ax = a_parent !== null && b_parent !== null && a_parent === b_parent; // ax+ax
  24976. // ->
  24977. // ax
  24978. if (bothDollars || ax_ax) {
  24979. mergedParents[k] = a_parent; // choose left
  24980. mergedReturnStates[k] = payload;
  24981. } else {
  24982. // ax+ay -> a'[x,y]
  24983. var mergedParent = merge(a_parent, b_parent, rootIsWildcard, mergeCache);
  24984. mergedParents[k] = mergedParent;
  24985. mergedReturnStates[k] = payload;
  24986. }
  24987. i += 1; // hop over left one as usual
  24988. j += 1; // but also skip one in right side since we merge
  24989. } else if (a.returnStates[i] < b.returnStates[j]) {
  24990. // copy a[i] to M
  24991. mergedParents[k] = a_parent;
  24992. mergedReturnStates[k] = a.returnStates[i];
  24993. i += 1;
  24994. } else {
  24995. // b > a, copy b[j] to M
  24996. mergedParents[k] = b_parent;
  24997. mergedReturnStates[k] = b.returnStates[j];
  24998. j += 1;
  24999. }
  25000. k += 1;
  25001. }
  25002. // copy over any payloads remaining in either array
  25003. if (i < a.returnStates.length) {
  25004. for (var p = i; p < a.returnStates.length; p++) {
  25005. mergedParents[k] = a.parents[p];
  25006. mergedReturnStates[k] = a.returnStates[p];
  25007. k += 1;
  25008. }
  25009. } else {
  25010. for (var p = j; p < b.returnStates.length; p++) {
  25011. mergedParents[k] = b.parents[p];
  25012. mergedReturnStates[k] = b.returnStates[p];
  25013. k += 1;
  25014. }
  25015. }
  25016. // trim merged if we combined a few that had same stack tops
  25017. if (k < mergedParents.length) {
  25018. // write index < last position; trim
  25019. if (k === 1) {
  25020. // for just one merged element, return singleton top
  25021. var a_ = SingletonPredictionContext.create(mergedParents[0], mergedReturnStates[0]);
  25022. if (mergeCache !== null) {
  25023. mergeCache.set(a, b, a_);
  25024. }
  25025. return a_;
  25026. }
  25027. mergedParents = mergedParents.slice(0, k);
  25028. mergedReturnStates = mergedReturnStates.slice(0, k);
  25029. }
  25030. var M = new ArrayPredictionContext(mergedParents, mergedReturnStates);
  25031. // if we created same array as a or b, return that instead
  25032. // TODO: track whether this is possible above during merge sort for speed
  25033. if (M === a) {
  25034. if (mergeCache !== null) {
  25035. mergeCache.set(a, b, a);
  25036. }
  25037. return a;
  25038. }
  25039. if (M === b) {
  25040. if (mergeCache !== null) {
  25041. mergeCache.set(a, b, b);
  25042. }
  25043. return b;
  25044. }
  25045. combineCommonParents(mergedParents);
  25046. if (mergeCache !== null) {
  25047. mergeCache.set(a, b, M);
  25048. }
  25049. return M;
  25050. }
  25051. //
  25052. // Make pass over all <em>M</em> {@code parents}; merge any {@code equals()}
  25053. // ones.
  25054. // /
  25055. function combineCommonParents(parents) {
  25056. var uniqueParents = {};
  25057. for (var p = 0; p < parents.length; p++) {
  25058. var parent = parents[p];
  25059. if (!(parent in uniqueParents)) {
  25060. uniqueParents[parent] = parent;
  25061. }
  25062. }
  25063. for (var q = 0; q < parents.length; q++) {
  25064. parents[q] = uniqueParents[parents[q]];
  25065. }
  25066. }
  25067. function getCachedPredictionContext(context, contextCache, visited) {
  25068. if (context.isEmpty()) {
  25069. return context;
  25070. }
  25071. var existing = visited[context] || null;
  25072. if (existing !== null) {
  25073. return existing;
  25074. }
  25075. existing = contextCache.get(context);
  25076. if (existing !== null) {
  25077. visited[context] = existing;
  25078. return existing;
  25079. }
  25080. var changed = false;
  25081. var parents = [];
  25082. for (var i = 0; i < parents.length; i++) {
  25083. var parent = getCachedPredictionContext(context.getParent(i), contextCache, visited);
  25084. if (changed || parent !== context.getParent(i)) {
  25085. if (!changed) {
  25086. parents = [];
  25087. for (var j = 0; j < context.length; j++) {
  25088. parents[j] = context.getParent(j);
  25089. }
  25090. changed = true;
  25091. }
  25092. parents[i] = parent;
  25093. }
  25094. }
  25095. if (!changed) {
  25096. contextCache.add(context);
  25097. visited[context] = context;
  25098. return context;
  25099. }
  25100. var updated = null;
  25101. if (parents.length === 0) {
  25102. updated = PredictionContext.EMPTY;
  25103. } else if (parents.length === 1) {
  25104. updated = SingletonPredictionContext.create(parents[0], context.getReturnState(0));
  25105. } else {
  25106. updated = new ArrayPredictionContext(parents, context.returnStates);
  25107. }
  25108. contextCache.add(updated);
  25109. visited[updated] = updated;
  25110. visited[context] = updated;
  25111. return updated;
  25112. }
  25113. // ter's recursive version of Sam's getAllNodes()
  25114. function getAllContextNodes(context, nodes, visited) {
  25115. if (nodes === null) {
  25116. nodes = [];
  25117. return getAllContextNodes(context, nodes, visited);
  25118. } else if (visited === null) {
  25119. visited = {};
  25120. return getAllContextNodes(context, nodes, visited);
  25121. } else {
  25122. if (context === null || visited[context] !== null) {
  25123. return nodes;
  25124. }
  25125. visited[context] = context;
  25126. nodes.push(context);
  25127. for (var i = 0; i < context.length; i++) {
  25128. getAllContextNodes(context.getParent(i), nodes, visited);
  25129. }
  25130. return nodes;
  25131. }
  25132. }
  25133. exports.merge = merge;
  25134. exports.PredictionContext = PredictionContext;
  25135. exports.PredictionContextCache = PredictionContextCache;
  25136. exports.SingletonPredictionContext = SingletonPredictionContext;
  25137. exports.predictionContextFromRuleContext = predictionContextFromRuleContext;
  25138. exports.getCachedPredictionContext = getCachedPredictionContext;
  25139. /***/ }),
  25140. /***/ "./node_modules/antlr4/Recognizer.js":
  25141. /*!*******************************************!*\
  25142. !*** ./node_modules/antlr4/Recognizer.js ***!
  25143. \*******************************************/
  25144. /*! no static exports found */
  25145. /***/ (function(module, exports, __webpack_require__) {
  25146. "use strict";
  25147. //
  25148. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  25149. * Use of this file is governed by the BSD 3-clause license that
  25150. * can be found in the LICENSE.txt file in the project root.
  25151. */
  25152. //
  25153. var Token = __webpack_require__(/*! ./Token */ "./node_modules/antlr4/Token.js").Token;
  25154. var ConsoleErrorListener = __webpack_require__(/*! ./error/ErrorListener */ "./node_modules/antlr4/error/ErrorListener.js").ConsoleErrorListener;
  25155. var ProxyErrorListener = __webpack_require__(/*! ./error/ErrorListener */ "./node_modules/antlr4/error/ErrorListener.js").ProxyErrorListener;
  25156. function Recognizer() {
  25157. this._listeners = [ConsoleErrorListener.INSTANCE];
  25158. this._interp = null;
  25159. this._stateNumber = -1;
  25160. return this;
  25161. }
  25162. Recognizer.tokenTypeMapCache = {};
  25163. Recognizer.ruleIndexMapCache = {};
  25164. Recognizer.prototype.checkVersion = function (toolVersion) {
  25165. var runtimeVersion = "4.7.1";
  25166. if (runtimeVersion !== toolVersion) {
  25167. console.log("ANTLR runtime and generated code versions disagree: " + runtimeVersion + "!=" + toolVersion);
  25168. }
  25169. };
  25170. Recognizer.prototype.addErrorListener = function (listener) {
  25171. this._listeners.push(listener);
  25172. };
  25173. Recognizer.prototype.removeErrorListeners = function () {
  25174. this._listeners = [];
  25175. };
  25176. Recognizer.prototype.getTokenTypeMap = function () {
  25177. var tokenNames = this.getTokenNames();
  25178. if (tokenNames === null) {
  25179. throw "The current recognizer does not provide a list of token names.";
  25180. }
  25181. var result = this.tokenTypeMapCache[tokenNames];
  25182. if (result === undefined) {
  25183. result = tokenNames.reduce(function (o, k, i) {
  25184. o[k] = i;
  25185. });
  25186. result.EOF = Token.EOF;
  25187. this.tokenTypeMapCache[tokenNames] = result;
  25188. }
  25189. return result;
  25190. };
  25191. // Get a map from rule names to rule indexes.
  25192. //
  25193. // <p>Used for XPath and tree pattern compilation.</p>
  25194. //
  25195. Recognizer.prototype.getRuleIndexMap = function () {
  25196. var ruleNames = this.ruleNames;
  25197. if (ruleNames === null) {
  25198. throw "The current recognizer does not provide a list of rule names.";
  25199. }
  25200. var result = this.ruleIndexMapCache[ruleNames];
  25201. if (result === undefined) {
  25202. result = ruleNames.reduce(function (o, k, i) {
  25203. o[k] = i;
  25204. });
  25205. this.ruleIndexMapCache[ruleNames] = result;
  25206. }
  25207. return result;
  25208. };
  25209. Recognizer.prototype.getTokenType = function (tokenName) {
  25210. var ttype = this.getTokenTypeMap()[tokenName];
  25211. if (ttype !== undefined) {
  25212. return ttype;
  25213. } else {
  25214. return Token.INVALID_TYPE;
  25215. }
  25216. };
  25217. // What is the error header, normally line/character position information?//
  25218. Recognizer.prototype.getErrorHeader = function (e) {
  25219. var line = e.getOffendingToken().line;
  25220. var column = e.getOffendingToken().column;
  25221. return "line " + line + ":" + column;
  25222. };
  25223. // How should a token be displayed in an error message? The default
  25224. // is to display just the text, but during development you might
  25225. // want to have a lot of information spit out. Override in that case
  25226. // to use t.toString() (which, for CommonToken, dumps everything about
  25227. // the token). This is better than forcing you to override a method in
  25228. // your token objects because you don't have to go modify your lexer
  25229. // so that it creates a new Java type.
  25230. //
  25231. // @deprecated This method is not called by the ANTLR 4 Runtime. Specific
  25232. // implementations of {@link ANTLRErrorStrategy} may provide a similar
  25233. // feature when necessary. For example, see
  25234. // {@link DefaultErrorStrategy//getTokenErrorDisplay}.
  25235. //
  25236. Recognizer.prototype.getTokenErrorDisplay = function (t) {
  25237. if (t === null) {
  25238. return "<no token>";
  25239. }
  25240. var s = t.text;
  25241. if (s === null) {
  25242. if (t.type === Token.EOF) {
  25243. s = "<EOF>";
  25244. } else {
  25245. s = "<" + t.type + ">";
  25246. }
  25247. }
  25248. s = s.replace("\n", "\\n").replace("\r", "\\r").replace("\t", "\\t");
  25249. return "'" + s + "'";
  25250. };
  25251. Recognizer.prototype.getErrorListenerDispatch = function () {
  25252. return new ProxyErrorListener(this._listeners);
  25253. };
  25254. // subclass needs to override these if there are sempreds or actions
  25255. // that the ATN interp needs to execute
  25256. Recognizer.prototype.sempred = function (localctx, ruleIndex, actionIndex) {
  25257. return true;
  25258. };
  25259. Recognizer.prototype.precpred = function (localctx, precedence) {
  25260. return true;
  25261. };
  25262. //Indicate that the recognizer has changed internal state that is
  25263. //consistent with the ATN state passed in. This way we always know
  25264. //where we are in the ATN as the parser goes along. The rule
  25265. //context objects form a stack that lets us see the stack of
  25266. //invoking rules. Combine this and we have complete ATN
  25267. //configuration information.
  25268. Object.defineProperty(Recognizer.prototype, "state", {
  25269. get: function get() {
  25270. return this._stateNumber;
  25271. },
  25272. set: function set(state) {
  25273. this._stateNumber = state;
  25274. }
  25275. });
  25276. exports.Recognizer = Recognizer;
  25277. /***/ }),
  25278. /***/ "./node_modules/antlr4/RuleContext.js":
  25279. /*!********************************************!*\
  25280. !*** ./node_modules/antlr4/RuleContext.js ***!
  25281. \********************************************/
  25282. /*! no static exports found */
  25283. /***/ (function(module, exports, __webpack_require__) {
  25284. "use strict";
  25285. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  25286. * Use of this file is governed by the BSD 3-clause license that
  25287. * can be found in the LICENSE.txt file in the project root.
  25288. */
  25289. ///
  25290. // A rule context is a record of a single rule invocation. It knows
  25291. // which context invoked it, if any. If there is no parent context, then
  25292. // naturally the invoking state is not valid. The parent link
  25293. // provides a chain upwards from the current rule invocation to the root
  25294. // of the invocation tree, forming a stack. We actually carry no
  25295. // information about the rule associated with this context (except
  25296. // when parsing). We keep only the state number of the invoking state from
  25297. // the ATN submachine that invoked this. Contrast this with the s
  25298. // pointer inside ParserRuleContext that tracks the current state
  25299. // being "executed" for the current rule.
  25300. //
  25301. // The parent contexts are useful for computing lookahead sets and
  25302. // getting error information.
  25303. //
  25304. // These objects are used during parsing and prediction.
  25305. // For the special case of parsers, we use the subclass
  25306. // ParserRuleContext.
  25307. //
  25308. // @see ParserRuleContext
  25309. ///
  25310. var RuleNode = __webpack_require__(/*! ./tree/Tree */ "./node_modules/antlr4/tree/Tree.js").RuleNode;
  25311. var INVALID_INTERVAL = __webpack_require__(/*! ./tree/Tree */ "./node_modules/antlr4/tree/Tree.js").INVALID_INTERVAL;
  25312. var INVALID_ALT_NUMBER = __webpack_require__(/*! ./atn/ATN */ "./node_modules/antlr4/atn/ATN.js").INVALID_ALT_NUMBER;
  25313. function RuleContext(parent, invokingState) {
  25314. RuleNode.call(this);
  25315. // What context invoked this rule?
  25316. this.parentCtx = parent || null;
  25317. // What state invoked the rule associated with this context?
  25318. // The "return address" is the followState of invokingState
  25319. // If parent is null, this should be -1.
  25320. this.invokingState = invokingState || -1;
  25321. return this;
  25322. }
  25323. RuleContext.prototype = Object.create(RuleNode.prototype);
  25324. RuleContext.prototype.constructor = RuleContext;
  25325. RuleContext.prototype.depth = function () {
  25326. var n = 0;
  25327. var p = this;
  25328. while (p !== null) {
  25329. p = p.parentCtx;
  25330. n += 1;
  25331. }
  25332. return n;
  25333. };
  25334. // A context is empty if there is no invoking state; meaning nobody call
  25335. // current context.
  25336. RuleContext.prototype.isEmpty = function () {
  25337. return this.invokingState === -1;
  25338. };
  25339. // satisfy the ParseTree / SyntaxTree interface
  25340. RuleContext.prototype.getSourceInterval = function () {
  25341. return INVALID_INTERVAL;
  25342. };
  25343. RuleContext.prototype.getRuleContext = function () {
  25344. return this;
  25345. };
  25346. RuleContext.prototype.getPayload = function () {
  25347. return this;
  25348. };
  25349. // Return the combined text of all child nodes. This method only considers
  25350. // tokens which have been added to the parse tree.
  25351. // <p>
  25352. // Since tokens on hidden channels (e.g. whitespace or comments) are not
  25353. // added to the parse trees, they will not appear in the output of this
  25354. // method.
  25355. // /
  25356. RuleContext.prototype.getText = function () {
  25357. if (this.getChildCount() === 0) {
  25358. return "";
  25359. } else {
  25360. return this.children.map(function (child) {
  25361. return child.getText();
  25362. }).join("");
  25363. }
  25364. };
  25365. // For rule associated with this parse tree internal node, return
  25366. // the outer alternative number used to match the input. Default
  25367. // implementation does not compute nor store this alt num. Create
  25368. // a subclass of ParserRuleContext with backing field and set
  25369. // option contextSuperClass.
  25370. // to set it.
  25371. RuleContext.prototype.getAltNumber = function () {
  25372. return INVALID_ALT_NUMBER;
  25373. };
  25374. // Set the outer alternative number for this context node. Default
  25375. // implementation does nothing to avoid backing field overhead for
  25376. // trees that don't need it. Create
  25377. // a subclass of ParserRuleContext with backing field and set
  25378. // option contextSuperClass.
  25379. RuleContext.prototype.setAltNumber = function (altNumber) {};
  25380. RuleContext.prototype.getChild = function (i) {
  25381. return null;
  25382. };
  25383. RuleContext.prototype.getChildCount = function () {
  25384. return 0;
  25385. };
  25386. RuleContext.prototype.accept = function (visitor) {
  25387. return visitor.visitChildren(this);
  25388. };
  25389. //need to manage circular dependencies, so export now
  25390. exports.RuleContext = RuleContext;
  25391. var Trees = __webpack_require__(/*! ./tree/Trees */ "./node_modules/antlr4/tree/Trees.js").Trees;
  25392. // Print out a whole tree, not just a node, in LISP format
  25393. // (root child1 .. childN). Print just a node if this is a leaf.
  25394. //
  25395. RuleContext.prototype.toStringTree = function (ruleNames, recog) {
  25396. return Trees.toStringTree(this, ruleNames, recog);
  25397. };
  25398. RuleContext.prototype.toString = function (ruleNames, stop) {
  25399. ruleNames = ruleNames || null;
  25400. stop = stop || null;
  25401. var p = this;
  25402. var s = "[";
  25403. while (p !== null && p !== stop) {
  25404. if (ruleNames === null) {
  25405. if (!p.isEmpty()) {
  25406. s += p.invokingState;
  25407. }
  25408. } else {
  25409. var ri = p.ruleIndex;
  25410. var ruleName = ri >= 0 && ri < ruleNames.length ? ruleNames[ri] : "" + ri;
  25411. s += ruleName;
  25412. }
  25413. if (p.parentCtx !== null && (ruleNames !== null || !p.parentCtx.isEmpty())) {
  25414. s += " ";
  25415. }
  25416. p = p.parentCtx;
  25417. }
  25418. s += "]";
  25419. return s;
  25420. };
  25421. /***/ }),
  25422. /***/ "./node_modules/antlr4/Token.js":
  25423. /*!**************************************!*\
  25424. !*** ./node_modules/antlr4/Token.js ***!
  25425. \**************************************/
  25426. /*! no static exports found */
  25427. /***/ (function(module, exports, __webpack_require__) {
  25428. "use strict";
  25429. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  25430. * Use of this file is governed by the BSD 3-clause license that
  25431. * can be found in the LICENSE.txt file in the project root.
  25432. */
  25433. //
  25434. // A token has properties: text, type, line, character position in the line
  25435. // (so we can ignore tabs), token channel, index, and source from which
  25436. // we obtained this token.
  25437. function Token() {
  25438. this.source = null;
  25439. this.type = null; // token type of the token
  25440. this.channel = null; // The parser ignores everything not on DEFAULT_CHANNEL
  25441. this.start = null; // optional; return -1 if not implemented.
  25442. this.stop = null; // optional; return -1 if not implemented.
  25443. this.tokenIndex = null; // from 0..n-1 of the token object in the input stream
  25444. this.line = null; // line=1..n of the 1st character
  25445. this.column = null; // beginning of the line at which it occurs, 0..n-1
  25446. this._text = null; // text of the token.
  25447. return this;
  25448. }
  25449. Token.INVALID_TYPE = 0;
  25450. // During lookahead operations, this "token" signifies we hit rule end ATN state
  25451. // and did not follow it despite needing to.
  25452. Token.EPSILON = -2;
  25453. Token.MIN_USER_TOKEN_TYPE = 1;
  25454. Token.EOF = -1;
  25455. // All tokens go to the parser (unless skip() is called in that rule)
  25456. // on a particular "channel". The parser tunes to a particular channel
  25457. // so that whitespace etc... can go to the parser on a "hidden" channel.
  25458. Token.DEFAULT_CHANNEL = 0;
  25459. // Anything on different channel than DEFAULT_CHANNEL is not parsed
  25460. // by parser.
  25461. Token.HIDDEN_CHANNEL = 1;
  25462. // Explicitly set the text for this token. If {code text} is not
  25463. // {@code null}, then {@link //getText} will return this value rather than
  25464. // extracting the text from the input.
  25465. //
  25466. // @param text The explicit text of the token, or {@code null} if the text
  25467. // should be obtained from the input along with the start and stop indexes
  25468. // of the token.
  25469. Object.defineProperty(Token.prototype, "text", {
  25470. get: function get() {
  25471. return this._text;
  25472. },
  25473. set: function set(text) {
  25474. this._text = text;
  25475. }
  25476. });
  25477. Token.prototype.getTokenSource = function () {
  25478. return this.source[0];
  25479. };
  25480. Token.prototype.getInputStream = function () {
  25481. return this.source[1];
  25482. };
  25483. function CommonToken(source, type, channel, start, stop) {
  25484. Token.call(this);
  25485. this.source = source !== undefined ? source : CommonToken.EMPTY_SOURCE;
  25486. this.type = type !== undefined ? type : null;
  25487. this.channel = channel !== undefined ? channel : Token.DEFAULT_CHANNEL;
  25488. this.start = start !== undefined ? start : -1;
  25489. this.stop = stop !== undefined ? stop : -1;
  25490. this.tokenIndex = -1;
  25491. if (this.source[0] !== null) {
  25492. this.line = source[0].line;
  25493. this.column = source[0].column;
  25494. } else {
  25495. this.column = -1;
  25496. }
  25497. return this;
  25498. }
  25499. CommonToken.prototype = Object.create(Token.prototype);
  25500. CommonToken.prototype.constructor = CommonToken;
  25501. // An empty {@link Pair} which is used as the default value of
  25502. // {@link //source} for tokens that do not have a source.
  25503. CommonToken.EMPTY_SOURCE = [null, null];
  25504. // Constructs a new {@link CommonToken} as a copy of another {@link Token}.
  25505. //
  25506. // <p>
  25507. // If {@code oldToken} is also a {@link CommonToken} instance, the newly
  25508. // constructed token will share a reference to the {@link //text} field and
  25509. // the {@link Pair} stored in {@link //source}. Otherwise, {@link //text} will
  25510. // be assigned the result of calling {@link //getText}, and {@link //source}
  25511. // will be constructed from the result of {@link Token//getTokenSource} and
  25512. // {@link Token//getInputStream}.</p>
  25513. //
  25514. // @param oldToken The token to copy.
  25515. //
  25516. CommonToken.prototype.clone = function () {
  25517. var t = new CommonToken(this.source, this.type, this.channel, this.start, this.stop);
  25518. t.tokenIndex = this.tokenIndex;
  25519. t.line = this.line;
  25520. t.column = this.column;
  25521. t.text = this.text;
  25522. return t;
  25523. };
  25524. Object.defineProperty(CommonToken.prototype, "text", {
  25525. get: function get() {
  25526. if (this._text !== null) {
  25527. return this._text;
  25528. }
  25529. var input = this.getInputStream();
  25530. if (input === null) {
  25531. return null;
  25532. }
  25533. var n = input.size;
  25534. if (this.start < n && this.stop < n) {
  25535. return input.getText(this.start, this.stop);
  25536. } else {
  25537. return "<EOF>";
  25538. }
  25539. },
  25540. set: function set(text) {
  25541. this._text = text;
  25542. }
  25543. });
  25544. CommonToken.prototype.toString = function () {
  25545. var txt = this.text;
  25546. if (txt !== null) {
  25547. txt = txt.replace(/\n/g, "\\n").replace(/\r/g, "\\r").replace(/\t/g, "\\t");
  25548. } else {
  25549. txt = "<no text>";
  25550. }
  25551. return "[@" + this.tokenIndex + "," + this.start + ":" + this.stop + "='" + txt + "',<" + this.type + ">" + (this.channel > 0 ? ",channel=" + this.channel : "") + "," + this.line + ":" + this.column + "]";
  25552. };
  25553. exports.Token = Token;
  25554. exports.CommonToken = CommonToken;
  25555. /***/ }),
  25556. /***/ "./node_modules/antlr4/Utils.js":
  25557. /*!**************************************!*\
  25558. !*** ./node_modules/antlr4/Utils.js ***!
  25559. \**************************************/
  25560. /*! no static exports found */
  25561. /***/ (function(module, exports, __webpack_require__) {
  25562. "use strict";
  25563. 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; };
  25564. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  25565. * Use of this file is governed by the BSD 3-clause license that
  25566. * can be found in the LICENSE.txt file in the project root.
  25567. */
  25568. function arrayToString(a) {
  25569. return "[" + a.join(", ") + "]";
  25570. }
  25571. String.prototype.seed = String.prototype.seed || Math.round(Math.random() * Math.pow(2, 32));
  25572. String.prototype.hashCode = function () {
  25573. var remainder,
  25574. bytes,
  25575. h1,
  25576. h1b,
  25577. c1,
  25578. c1b,
  25579. c2,
  25580. c2b,
  25581. k1,
  25582. i,
  25583. key = this.toString();
  25584. remainder = key.length & 3; // key.length % 4
  25585. bytes = key.length - remainder;
  25586. h1 = String.prototype.seed;
  25587. c1 = 0xcc9e2d51;
  25588. c2 = 0x1b873593;
  25589. i = 0;
  25590. while (i < bytes) {
  25591. k1 = key.charCodeAt(i) & 0xff | (key.charCodeAt(++i) & 0xff) << 8 | (key.charCodeAt(++i) & 0xff) << 16 | (key.charCodeAt(++i) & 0xff) << 24;
  25592. ++i;
  25593. k1 = (k1 & 0xffff) * c1 + (((k1 >>> 16) * c1 & 0xffff) << 16) & 0xffffffff;
  25594. k1 = k1 << 15 | k1 >>> 17;
  25595. k1 = (k1 & 0xffff) * c2 + (((k1 >>> 16) * c2 & 0xffff) << 16) & 0xffffffff;
  25596. h1 ^= k1;
  25597. h1 = h1 << 13 | h1 >>> 19;
  25598. h1b = (h1 & 0xffff) * 5 + (((h1 >>> 16) * 5 & 0xffff) << 16) & 0xffffffff;
  25599. h1 = (h1b & 0xffff) + 0x6b64 + (((h1b >>> 16) + 0xe654 & 0xffff) << 16);
  25600. }
  25601. k1 = 0;
  25602. switch (remainder) {
  25603. case 3:
  25604. k1 ^= (key.charCodeAt(i + 2) & 0xff) << 16;
  25605. case 2:
  25606. k1 ^= (key.charCodeAt(i + 1) & 0xff) << 8;
  25607. case 1:
  25608. k1 ^= key.charCodeAt(i) & 0xff;
  25609. k1 = (k1 & 0xffff) * c1 + (((k1 >>> 16) * c1 & 0xffff) << 16) & 0xffffffff;
  25610. k1 = k1 << 15 | k1 >>> 17;
  25611. k1 = (k1 & 0xffff) * c2 + (((k1 >>> 16) * c2 & 0xffff) << 16) & 0xffffffff;
  25612. h1 ^= k1;
  25613. }
  25614. h1 ^= key.length;
  25615. h1 ^= h1 >>> 16;
  25616. h1 = (h1 & 0xffff) * 0x85ebca6b + (((h1 >>> 16) * 0x85ebca6b & 0xffff) << 16) & 0xffffffff;
  25617. h1 ^= h1 >>> 13;
  25618. h1 = (h1 & 0xffff) * 0xc2b2ae35 + (((h1 >>> 16) * 0xc2b2ae35 & 0xffff) << 16) & 0xffffffff;
  25619. h1 ^= h1 >>> 16;
  25620. return h1 >>> 0;
  25621. };
  25622. function standardEqualsFunction(a, b) {
  25623. return a.equals(b);
  25624. }
  25625. function standardHashCodeFunction(a) {
  25626. return a.hashCode();
  25627. }
  25628. function Set(hashFunction, equalsFunction) {
  25629. this.data = {};
  25630. this.hashFunction = hashFunction || standardHashCodeFunction;
  25631. this.equalsFunction = equalsFunction || standardEqualsFunction;
  25632. return this;
  25633. }
  25634. Object.defineProperty(Set.prototype, "length", {
  25635. get: function get() {
  25636. var l = 0;
  25637. for (var key in this.data) {
  25638. if (key.indexOf("hash_") === 0) {
  25639. l = l + this.data[key].length;
  25640. }
  25641. }
  25642. return l;
  25643. }
  25644. });
  25645. Set.prototype.add = function (value) {
  25646. var hash = this.hashFunction(value);
  25647. var key = "hash_" + hash;
  25648. if (key in this.data) {
  25649. var values = this.data[key];
  25650. for (var i = 0; i < values.length; i++) {
  25651. if (this.equalsFunction(value, values[i])) {
  25652. return values[i];
  25653. }
  25654. }
  25655. values.push(value);
  25656. return value;
  25657. } else {
  25658. this.data[key] = [value];
  25659. return value;
  25660. }
  25661. };
  25662. Set.prototype.contains = function (value) {
  25663. return this.get(value) != null;
  25664. };
  25665. Set.prototype.get = function (value) {
  25666. var hash = this.hashFunction(value);
  25667. var key = "hash_" + hash;
  25668. if (key in this.data) {
  25669. var values = this.data[key];
  25670. for (var i = 0; i < values.length; i++) {
  25671. if (this.equalsFunction(value, values[i])) {
  25672. return values[i];
  25673. }
  25674. }
  25675. }
  25676. return null;
  25677. };
  25678. Set.prototype.values = function () {
  25679. var l = [];
  25680. for (var key in this.data) {
  25681. if (key.indexOf("hash_") === 0) {
  25682. l = l.concat(this.data[key]);
  25683. }
  25684. }
  25685. return l;
  25686. };
  25687. Set.prototype.toString = function () {
  25688. return arrayToString(this.values());
  25689. };
  25690. function BitSet() {
  25691. this.data = [];
  25692. return this;
  25693. }
  25694. BitSet.prototype.add = function (value) {
  25695. this.data[value] = true;
  25696. };
  25697. BitSet.prototype.or = function (set) {
  25698. var bits = this;
  25699. Object.keys(set.data).map(function (alt) {
  25700. bits.add(alt);
  25701. });
  25702. };
  25703. BitSet.prototype.remove = function (value) {
  25704. delete this.data[value];
  25705. };
  25706. BitSet.prototype.contains = function (value) {
  25707. return this.data[value] === true;
  25708. };
  25709. BitSet.prototype.values = function () {
  25710. return Object.keys(this.data);
  25711. };
  25712. BitSet.prototype.minValue = function () {
  25713. return Math.min.apply(null, this.values());
  25714. };
  25715. BitSet.prototype.hashCode = function () {
  25716. var hash = new Hash();
  25717. hash.update(this.values());
  25718. return hash.finish();
  25719. };
  25720. BitSet.prototype.equals = function (other) {
  25721. if (!(other instanceof BitSet)) {
  25722. return false;
  25723. }
  25724. return this.hashCode() === other.hashCode();
  25725. };
  25726. Object.defineProperty(BitSet.prototype, "length", {
  25727. get: function get() {
  25728. return this.values().length;
  25729. }
  25730. });
  25731. BitSet.prototype.toString = function () {
  25732. return "{" + this.values().join(", ") + "}";
  25733. };
  25734. function Map(hashFunction, equalsFunction) {
  25735. this.data = {};
  25736. this.hashFunction = hashFunction || standardHashCodeFunction;
  25737. this.equalsFunction = equalsFunction || standardEqualsFunction;
  25738. return this;
  25739. }
  25740. Object.defineProperty(Map.prototype, "length", {
  25741. get: function get() {
  25742. var l = 0;
  25743. for (var hashKey in this.data) {
  25744. if (hashKey.indexOf("hash_") === 0) {
  25745. l = l + this.data[hashKey].length;
  25746. }
  25747. }
  25748. return l;
  25749. }
  25750. });
  25751. Map.prototype.put = function (key, value) {
  25752. var hashKey = "hash_" + this.hashFunction(key);
  25753. if (hashKey in this.data) {
  25754. var entries = this.data[hashKey];
  25755. for (var i = 0; i < entries.length; i++) {
  25756. var entry = entries[i];
  25757. if (this.equalsFunction(key, entry.key)) {
  25758. var oldValue = entry.value;
  25759. entry.value = value;
  25760. return oldValue;
  25761. }
  25762. }
  25763. entries.push({ key: key, value: value });
  25764. return value;
  25765. } else {
  25766. this.data[hashKey] = [{ key: key, value: value }];
  25767. return value;
  25768. }
  25769. };
  25770. Map.prototype.containsKey = function (key) {
  25771. var hashKey = "hash_" + this.hashFunction(key);
  25772. if (hashKey in this.data) {
  25773. var entries = this.data[hashKey];
  25774. for (var i = 0; i < entries.length; i++) {
  25775. var entry = entries[i];
  25776. if (this.equalsFunction(key, entry.key)) return true;
  25777. }
  25778. }
  25779. return false;
  25780. };
  25781. Map.prototype.get = function (key) {
  25782. var hashKey = "hash_" + this.hashFunction(key);
  25783. if (hashKey in this.data) {
  25784. var entries = this.data[hashKey];
  25785. for (var i = 0; i < entries.length; i++) {
  25786. var entry = entries[i];
  25787. if (this.equalsFunction(key, entry.key)) return entry.value;
  25788. }
  25789. }
  25790. return null;
  25791. };
  25792. Map.prototype.entries = function () {
  25793. var l = [];
  25794. for (var key in this.data) {
  25795. if (key.indexOf("hash_") === 0) {
  25796. l = l.concat(this.data[key]);
  25797. }
  25798. }
  25799. return l;
  25800. };
  25801. Map.prototype.getKeys = function () {
  25802. return this.entries().map(function (e) {
  25803. return e.key;
  25804. });
  25805. };
  25806. Map.prototype.getValues = function () {
  25807. return this.entries().map(function (e) {
  25808. return e.value;
  25809. });
  25810. };
  25811. Map.prototype.toString = function () {
  25812. var ss = this.entries().map(function (entry) {
  25813. return '{' + entry.key + ':' + entry.value + '}';
  25814. });
  25815. return '[' + ss.join(", ") + ']';
  25816. };
  25817. function AltDict() {
  25818. this.data = {};
  25819. return this;
  25820. }
  25821. AltDict.prototype.get = function (key) {
  25822. key = "k-" + key;
  25823. if (key in this.data) {
  25824. return this.data[key];
  25825. } else {
  25826. return null;
  25827. }
  25828. };
  25829. AltDict.prototype.put = function (key, value) {
  25830. key = "k-" + key;
  25831. this.data[key] = value;
  25832. };
  25833. AltDict.prototype.values = function () {
  25834. var data = this.data;
  25835. var keys = Object.keys(this.data);
  25836. return keys.map(function (key) {
  25837. return data[key];
  25838. });
  25839. };
  25840. function DoubleDict() {
  25841. return this;
  25842. }
  25843. function Hash() {
  25844. this.count = 0;
  25845. this.hash = 0;
  25846. return this;
  25847. }
  25848. Hash.prototype.update = function () {
  25849. for (var i = 0; i < arguments.length; i++) {
  25850. var value = arguments[i];
  25851. if (value == null) continue;
  25852. if (Array.isArray(value)) this.update.apply(value);else {
  25853. var k = 0;
  25854. switch (typeof value === "undefined" ? "undefined" : _typeof(value)) {
  25855. case 'undefined':
  25856. case 'function':
  25857. continue;
  25858. case 'number':
  25859. case 'boolean':
  25860. k = value;
  25861. break;
  25862. case 'string':
  25863. k = value.hashCode();
  25864. break;
  25865. default:
  25866. value.updateHashCode(this);
  25867. continue;
  25868. }
  25869. k = k * 0xCC9E2D51;
  25870. k = k << 15 | k >>> 32 - 15;
  25871. k = k * 0x1B873593;
  25872. this.count = this.count + 1;
  25873. var hash = this.hash ^ k;
  25874. hash = hash << 13 | hash >>> 32 - 13;
  25875. hash = hash * 5 + 0xE6546B64;
  25876. this.hash = hash;
  25877. }
  25878. }
  25879. };
  25880. Hash.prototype.finish = function () {
  25881. var hash = this.hash ^ this.count * 4;
  25882. hash = hash ^ hash >>> 16;
  25883. hash = hash * 0x85EBCA6B;
  25884. hash = hash ^ hash >>> 13;
  25885. hash = hash * 0xC2B2AE35;
  25886. hash = hash ^ hash >>> 16;
  25887. return hash;
  25888. };
  25889. function hashStuff() {
  25890. var hash = new Hash();
  25891. hash.update.apply(arguments);
  25892. return hash.finish();
  25893. }
  25894. DoubleDict.prototype.get = function (a, b) {
  25895. var d = this[a] || null;
  25896. return d === null ? null : d[b] || null;
  25897. };
  25898. DoubleDict.prototype.set = function (a, b, o) {
  25899. var d = this[a] || null;
  25900. if (d === null) {
  25901. d = {};
  25902. this[a] = d;
  25903. }
  25904. d[b] = o;
  25905. };
  25906. function escapeWhitespace(s, escapeSpaces) {
  25907. s = s.replace(/\t/g, "\\t").replace(/\n/g, "\\n").replace(/\r/g, "\\r");
  25908. if (escapeSpaces) {
  25909. s = s.replace(/ /g, "\xB7");
  25910. }
  25911. return s;
  25912. }
  25913. function titleCase(str) {
  25914. return str.replace(/\w\S*/g, function (txt) {
  25915. return txt.charAt(0).toUpperCase() + txt.substr(1);
  25916. });
  25917. };
  25918. function equalArrays(a, b) {
  25919. if (!Array.isArray(a) || !Array.isArray(b)) return false;
  25920. if (a == b) return true;
  25921. if (a.length != b.length) return false;
  25922. for (var i = 0; i < a.length; i++) {
  25923. if (a[i] == b[i]) continue;
  25924. if (!a[i].equals(b[i])) return false;
  25925. }
  25926. return true;
  25927. };
  25928. exports.Hash = Hash;
  25929. exports.Set = Set;
  25930. exports.Map = Map;
  25931. exports.BitSet = BitSet;
  25932. exports.AltDict = AltDict;
  25933. exports.DoubleDict = DoubleDict;
  25934. exports.hashStuff = hashStuff;
  25935. exports.escapeWhitespace = escapeWhitespace;
  25936. exports.arrayToString = arrayToString;
  25937. exports.titleCase = titleCase;
  25938. exports.equalArrays = equalArrays;
  25939. /***/ }),
  25940. /***/ "./node_modules/antlr4/atn/ATN.js":
  25941. /*!****************************************!*\
  25942. !*** ./node_modules/antlr4/atn/ATN.js ***!
  25943. \****************************************/
  25944. /*! no static exports found */
  25945. /***/ (function(module, exports, __webpack_require__) {
  25946. "use strict";
  25947. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  25948. * Use of this file is governed by the BSD 3-clause license that
  25949. * can be found in the LICENSE.txt file in the project root.
  25950. */
  25951. var LL1Analyzer = __webpack_require__(/*! ./../LL1Analyzer */ "./node_modules/antlr4/LL1Analyzer.js").LL1Analyzer;
  25952. var IntervalSet = __webpack_require__(/*! ./../IntervalSet */ "./node_modules/antlr4/IntervalSet.js").IntervalSet;
  25953. function ATN(grammarType, maxTokenType) {
  25954. // Used for runtime deserialization of ATNs from strings///
  25955. // The type of the ATN.
  25956. this.grammarType = grammarType;
  25957. // The maximum value for any symbol recognized by a transition in the ATN.
  25958. this.maxTokenType = maxTokenType;
  25959. this.states = [];
  25960. // Each subrule/rule is a decision point and we must track them so we
  25961. // can go back later and build DFA predictors for them. This includes
  25962. // all the rules, subrules, optional blocks, ()+, ()* etc...
  25963. this.decisionToState = [];
  25964. // Maps from rule index to starting state number.
  25965. this.ruleToStartState = [];
  25966. // Maps from rule index to stop state number.
  25967. this.ruleToStopState = null;
  25968. this.modeNameToStartState = {};
  25969. // For lexer ATNs, this maps the rule index to the resulting token type.
  25970. // For parser ATNs, this maps the rule index to the generated bypass token
  25971. // type if the
  25972. // {@link ATNDeserializationOptions//isGenerateRuleBypassTransitions}
  25973. // deserialization option was specified; otherwise, this is {@code null}.
  25974. this.ruleToTokenType = null;
  25975. // For lexer ATNs, this is an array of {@link LexerAction} objects which may
  25976. // be referenced by action transitions in the ATN.
  25977. this.lexerActions = null;
  25978. this.modeToStartState = [];
  25979. return this;
  25980. }
  25981. // Compute the set of valid tokens that can occur starting in state {@code s}.
  25982. // If {@code ctx} is null, the set of tokens will not include what can follow
  25983. // the rule surrounding {@code s}. In other words, the set will be
  25984. // restricted to tokens reachable staying within {@code s}'s rule.
  25985. ATN.prototype.nextTokensInContext = function (s, ctx) {
  25986. var anal = new LL1Analyzer(this);
  25987. return anal.LOOK(s, null, ctx);
  25988. };
  25989. // Compute the set of valid tokens that can occur starting in {@code s} and
  25990. // staying in same rule. {@link Token//EPSILON} is in set if we reach end of
  25991. // rule.
  25992. ATN.prototype.nextTokensNoContext = function (s) {
  25993. if (s.nextTokenWithinRule !== null) {
  25994. return s.nextTokenWithinRule;
  25995. }
  25996. s.nextTokenWithinRule = this.nextTokensInContext(s, null);
  25997. s.nextTokenWithinRule.readOnly = true;
  25998. return s.nextTokenWithinRule;
  25999. };
  26000. ATN.prototype.nextTokens = function (s, ctx) {
  26001. if (ctx === undefined) {
  26002. return this.nextTokensNoContext(s);
  26003. } else {
  26004. return this.nextTokensInContext(s, ctx);
  26005. }
  26006. };
  26007. ATN.prototype.addState = function (state) {
  26008. if (state !== null) {
  26009. state.atn = this;
  26010. state.stateNumber = this.states.length;
  26011. }
  26012. this.states.push(state);
  26013. };
  26014. ATN.prototype.removeState = function (state) {
  26015. this.states[state.stateNumber] = null; // just free mem, don't shift states in list
  26016. };
  26017. ATN.prototype.defineDecisionState = function (s) {
  26018. this.decisionToState.push(s);
  26019. s.decision = this.decisionToState.length - 1;
  26020. return s.decision;
  26021. };
  26022. ATN.prototype.getDecisionState = function (decision) {
  26023. if (this.decisionToState.length === 0) {
  26024. return null;
  26025. } else {
  26026. return this.decisionToState[decision];
  26027. }
  26028. };
  26029. // Computes the set of input symbols which could follow ATN state number
  26030. // {@code stateNumber} in the specified full {@code context}. This method
  26031. // considers the complete parser context, but does not evaluate semantic
  26032. // predicates (i.e. all predicates encountered during the calculation are
  26033. // assumed true). If a path in the ATN exists from the starting state to the
  26034. // {@link RuleStopState} of the outermost context without matching any
  26035. // symbols, {@link Token//EOF} is added to the returned set.
  26036. //
  26037. // <p>If {@code context} is {@code null}, it is treated as
  26038. // {@link ParserRuleContext//EMPTY}.</p>
  26039. //
  26040. // @param stateNumber the ATN state number
  26041. // @param context the full parse context
  26042. // @return The set of potentially valid input symbols which could follow the
  26043. // specified state in the specified context.
  26044. // @throws IllegalArgumentException if the ATN does not contain a state with
  26045. // number {@code stateNumber}
  26046. var Token = __webpack_require__(/*! ./../Token */ "./node_modules/antlr4/Token.js").Token;
  26047. ATN.prototype.getExpectedTokens = function (stateNumber, ctx) {
  26048. if (stateNumber < 0 || stateNumber >= this.states.length) {
  26049. throw "Invalid state number.";
  26050. }
  26051. var s = this.states[stateNumber];
  26052. var following = this.nextTokens(s);
  26053. if (!following.contains(Token.EPSILON)) {
  26054. return following;
  26055. }
  26056. var expected = new IntervalSet();
  26057. expected.addSet(following);
  26058. expected.removeOne(Token.EPSILON);
  26059. while (ctx !== null && ctx.invokingState >= 0 && following.contains(Token.EPSILON)) {
  26060. var invokingState = this.states[ctx.invokingState];
  26061. var rt = invokingState.transitions[0];
  26062. following = this.nextTokens(rt.followState);
  26063. expected.addSet(following);
  26064. expected.removeOne(Token.EPSILON);
  26065. ctx = ctx.parentCtx;
  26066. }
  26067. if (following.contains(Token.EPSILON)) {
  26068. expected.addOne(Token.EOF);
  26069. }
  26070. return expected;
  26071. };
  26072. ATN.INVALID_ALT_NUMBER = 0;
  26073. exports.ATN = ATN;
  26074. /***/ }),
  26075. /***/ "./node_modules/antlr4/atn/ATNConfig.js":
  26076. /*!**********************************************!*\
  26077. !*** ./node_modules/antlr4/atn/ATNConfig.js ***!
  26078. \**********************************************/
  26079. /*! no static exports found */
  26080. /***/ (function(module, exports, __webpack_require__) {
  26081. "use strict";
  26082. //
  26083. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  26084. * Use of this file is governed by the BSD 3-clause license that
  26085. * can be found in the LICENSE.txt file in the project root.
  26086. */
  26087. ///
  26088. // A tuple: (ATN state, predicted alt, syntactic, semantic context).
  26089. // The syntactic context is a graph-structured stack node whose
  26090. // path(s) to the root is the rule invocation(s)
  26091. // chain used to arrive at the state. The semantic context is
  26092. // the tree of semantic predicates encountered before reaching
  26093. // an ATN state.
  26094. ///
  26095. var DecisionState = __webpack_require__(/*! ./ATNState */ "./node_modules/antlr4/atn/ATNState.js").DecisionState;
  26096. var SemanticContext = __webpack_require__(/*! ./SemanticContext */ "./node_modules/antlr4/atn/SemanticContext.js").SemanticContext;
  26097. var Hash = __webpack_require__(/*! ../Utils */ "./node_modules/antlr4/Utils.js").Hash;
  26098. function checkParams(params, isCfg) {
  26099. if (params === null) {
  26100. var result = { state: null, alt: null, context: null, semanticContext: null };
  26101. if (isCfg) {
  26102. result.reachesIntoOuterContext = 0;
  26103. }
  26104. return result;
  26105. } else {
  26106. var props = {};
  26107. props.state = params.state || null;
  26108. props.alt = params.alt === undefined ? null : params.alt;
  26109. props.context = params.context || null;
  26110. props.semanticContext = params.semanticContext || null;
  26111. if (isCfg) {
  26112. props.reachesIntoOuterContext = params.reachesIntoOuterContext || 0;
  26113. props.precedenceFilterSuppressed = params.precedenceFilterSuppressed || false;
  26114. }
  26115. return props;
  26116. }
  26117. }
  26118. function ATNConfig(params, config) {
  26119. this.checkContext(params, config);
  26120. params = checkParams(params);
  26121. config = checkParams(config, true);
  26122. // The ATN state associated with this configuration///
  26123. this.state = params.state !== null ? params.state : config.state;
  26124. // What alt (or lexer rule) is predicted by this configuration///
  26125. this.alt = params.alt !== null ? params.alt : config.alt;
  26126. // The stack of invoking states leading to the rule/states associated
  26127. // with this config. We track only those contexts pushed during
  26128. // execution of the ATN simulator.
  26129. this.context = params.context !== null ? params.context : config.context;
  26130. this.semanticContext = params.semanticContext !== null ? params.semanticContext : config.semanticContext !== null ? config.semanticContext : SemanticContext.NONE;
  26131. // We cannot execute predicates dependent upon local context unless
  26132. // we know for sure we are in the correct context. Because there is
  26133. // no way to do this efficiently, we simply cannot evaluate
  26134. // dependent predicates unless we are in the rule that initially
  26135. // invokes the ATN simulator.
  26136. //
  26137. // closure() tracks the depth of how far we dip into the
  26138. // outer context: depth &gt; 0. Note that it may not be totally
  26139. // accurate depth since I don't ever decrement. TODO: make it a boolean then
  26140. this.reachesIntoOuterContext = config.reachesIntoOuterContext;
  26141. this.precedenceFilterSuppressed = config.precedenceFilterSuppressed;
  26142. return this;
  26143. }
  26144. ATNConfig.prototype.checkContext = function (params, config) {
  26145. if ((params.context === null || params.context === undefined) && (config === null || config.context === null || config.context === undefined)) {
  26146. this.context = null;
  26147. }
  26148. };
  26149. ATNConfig.prototype.hashCode = function () {
  26150. var hash = new Hash();
  26151. this.updateHashCode(hash);
  26152. return hash.finish();
  26153. };
  26154. ATNConfig.prototype.updateHashCode = function (hash) {
  26155. hash.update(this.state.stateNumber, this.alt, this.context, this.semanticContext);
  26156. };
  26157. // An ATN configuration is equal to another if both have
  26158. // the same state, they predict the same alternative, and
  26159. // syntactic/semantic contexts are the same.
  26160. ATNConfig.prototype.equals = function (other) {
  26161. if (this === other) {
  26162. return true;
  26163. } else if (!(other instanceof ATNConfig)) {
  26164. return false;
  26165. } else {
  26166. 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;
  26167. }
  26168. };
  26169. ATNConfig.prototype.hashCodeForConfigSet = function () {
  26170. var hash = new Hash();
  26171. hash.update(this.state.stateNumber, this.alt, this.semanticContext);
  26172. return hash.finish();
  26173. };
  26174. ATNConfig.prototype.equalsForConfigSet = function (other) {
  26175. if (this === other) {
  26176. return true;
  26177. } else if (!(other instanceof ATNConfig)) {
  26178. return false;
  26179. } else {
  26180. return this.state.stateNumber === other.state.stateNumber && this.alt === other.alt && this.semanticContext.equals(other.semanticContext);
  26181. }
  26182. };
  26183. ATNConfig.prototype.toString = function () {
  26184. return "(" + this.state + "," + this.alt + (this.context !== null ? ",[" + this.context.toString() + "]" : "") + (this.semanticContext !== SemanticContext.NONE ? "," + this.semanticContext.toString() : "") + (this.reachesIntoOuterContext > 0 ? ",up=" + this.reachesIntoOuterContext : "") + ")";
  26185. };
  26186. function LexerATNConfig(params, config) {
  26187. ATNConfig.call(this, params, config);
  26188. // This is the backing field for {@link //getLexerActionExecutor}.
  26189. var lexerActionExecutor = params.lexerActionExecutor || null;
  26190. this.lexerActionExecutor = lexerActionExecutor || (config !== null ? config.lexerActionExecutor : null);
  26191. this.passedThroughNonGreedyDecision = config !== null ? this.checkNonGreedyDecision(config, this.state) : false;
  26192. return this;
  26193. }
  26194. LexerATNConfig.prototype = Object.create(ATNConfig.prototype);
  26195. LexerATNConfig.prototype.constructor = LexerATNConfig;
  26196. LexerATNConfig.prototype.updateHashCode = function (hash) {
  26197. hash.update(this.state.stateNumber, this.alt, this.context, this.semanticContext, this.passedThroughNonGreedyDecision, this.lexerActionExecutor);
  26198. };
  26199. LexerATNConfig.prototype.equals = function (other) {
  26200. 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);
  26201. };
  26202. LexerATNConfig.prototype.hashCodeForConfigSet = LexerATNConfig.prototype.hashCode;
  26203. LexerATNConfig.prototype.equalsForConfigSet = LexerATNConfig.prototype.equals;
  26204. LexerATNConfig.prototype.checkNonGreedyDecision = function (source, target) {
  26205. return source.passedThroughNonGreedyDecision || target instanceof DecisionState && target.nonGreedy;
  26206. };
  26207. exports.ATNConfig = ATNConfig;
  26208. exports.LexerATNConfig = LexerATNConfig;
  26209. /***/ }),
  26210. /***/ "./node_modules/antlr4/atn/ATNConfigSet.js":
  26211. /*!*************************************************!*\
  26212. !*** ./node_modules/antlr4/atn/ATNConfigSet.js ***!
  26213. \*************************************************/
  26214. /*! no static exports found */
  26215. /***/ (function(module, exports, __webpack_require__) {
  26216. "use strict";
  26217. //
  26218. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  26219. * Use of this file is governed by the BSD 3-clause license that
  26220. * can be found in the LICENSE.txt file in the project root.
  26221. */
  26222. //
  26223. // Specialized {@link Set}{@code <}{@link ATNConfig}{@code >} that can track
  26224. // info about the set, with support for combining similar configurations using a
  26225. // graph-structured stack.
  26226. ///
  26227. var ATN = __webpack_require__(/*! ./ATN */ "./node_modules/antlr4/atn/ATN.js").ATN;
  26228. var Utils = __webpack_require__(/*! ./../Utils */ "./node_modules/antlr4/Utils.js");
  26229. var Hash = Utils.Hash;
  26230. var Set = Utils.Set;
  26231. var SemanticContext = __webpack_require__(/*! ./SemanticContext */ "./node_modules/antlr4/atn/SemanticContext.js").SemanticContext;
  26232. var merge = __webpack_require__(/*! ./../PredictionContext */ "./node_modules/antlr4/PredictionContext.js").merge;
  26233. function hashATNConfig(c) {
  26234. return c.hashCodeForConfigSet();
  26235. }
  26236. function equalATNConfigs(a, b) {
  26237. if (a === b) {
  26238. return true;
  26239. } else if (a === null || b === null) {
  26240. return false;
  26241. } else return a.equalsForConfigSet(b);
  26242. }
  26243. function ATNConfigSet(fullCtx) {
  26244. //
  26245. // The reason that we need this is because we don't want the hash map to use
  26246. // the standard hash code and equals. We need all configurations with the
  26247. // same
  26248. // {@code (s,i,_,semctx)} to be equal. Unfortunately, this key effectively
  26249. // doubles
  26250. // the number of objects associated with ATNConfigs. The other solution is
  26251. // to
  26252. // use a hash table that lets us specify the equals/hashcode operation.
  26253. // All configs but hashed by (s, i, _, pi) not including context. Wiped out
  26254. // when we go readonly as this set becomes a DFA state.
  26255. this.configLookup = new Set(hashATNConfig, equalATNConfigs);
  26256. // Indicates that this configuration set is part of a full context
  26257. // LL prediction. It will be used to determine how to merge $. With SLL
  26258. // it's a wildcard whereas it is not for LL context merge.
  26259. this.fullCtx = fullCtx === undefined ? true : fullCtx;
  26260. // Indicates that the set of configurations is read-only. Do not
  26261. // allow any code to manipulate the set; DFA states will point at
  26262. // the sets and they must not change. This does not protect the other
  26263. // fields; in particular, conflictingAlts is set after
  26264. // we've made this readonly.
  26265. this.readOnly = false;
  26266. // Track the elements as they are added to the set; supports get(i)///
  26267. this.configs = [];
  26268. // TODO: these fields make me pretty uncomfortable but nice to pack up info
  26269. // together, saves recomputation
  26270. // TODO: can we track conflicts as they are added to save scanning configs
  26271. // later?
  26272. this.uniqueAlt = 0;
  26273. this.conflictingAlts = null;
  26274. // Used in parser and lexer. In lexer, it indicates we hit a pred
  26275. // while computing a closure operation. Don't make a DFA state from this.
  26276. this.hasSemanticContext = false;
  26277. this.dipsIntoOuterContext = false;
  26278. this.cachedHashCode = -1;
  26279. return this;
  26280. }
  26281. // Adding a new config means merging contexts with existing configs for
  26282. // {@code (s, i, pi, _)}, where {@code s} is the
  26283. // {@link ATNConfig//state}, {@code i} is the {@link ATNConfig//alt}, and
  26284. // {@code pi} is the {@link ATNConfig//semanticContext}. We use
  26285. // {@code (s,i,pi)} as key.
  26286. //
  26287. // <p>This method updates {@link //dipsIntoOuterContext} and
  26288. // {@link //hasSemanticContext} when necessary.</p>
  26289. // /
  26290. ATNConfigSet.prototype.add = function (config, mergeCache) {
  26291. if (mergeCache === undefined) {
  26292. mergeCache = null;
  26293. }
  26294. if (this.readOnly) {
  26295. throw "This set is readonly";
  26296. }
  26297. if (config.semanticContext !== SemanticContext.NONE) {
  26298. this.hasSemanticContext = true;
  26299. }
  26300. if (config.reachesIntoOuterContext > 0) {
  26301. this.dipsIntoOuterContext = true;
  26302. }
  26303. var existing = this.configLookup.add(config);
  26304. if (existing === config) {
  26305. this.cachedHashCode = -1;
  26306. this.configs.push(config); // track order here
  26307. return true;
  26308. }
  26309. // a previous (s,i,pi,_), merge with it and save result
  26310. var rootIsWildcard = !this.fullCtx;
  26311. var merged = merge(existing.context, config.context, rootIsWildcard, mergeCache);
  26312. // no need to check for existing.context, config.context in cache
  26313. // since only way to create new graphs is "call rule" and here. We
  26314. // cache at both places.
  26315. existing.reachesIntoOuterContext = Math.max(existing.reachesIntoOuterContext, config.reachesIntoOuterContext);
  26316. // make sure to preserve the precedence filter suppression during the merge
  26317. if (config.precedenceFilterSuppressed) {
  26318. existing.precedenceFilterSuppressed = true;
  26319. }
  26320. existing.context = merged; // replace context; no need to alt mapping
  26321. return true;
  26322. };
  26323. ATNConfigSet.prototype.getStates = function () {
  26324. var states = new Set();
  26325. for (var i = 0; i < this.configs.length; i++) {
  26326. states.add(this.configs[i].state);
  26327. }
  26328. return states;
  26329. };
  26330. ATNConfigSet.prototype.getPredicates = function () {
  26331. var preds = [];
  26332. for (var i = 0; i < this.configs.length; i++) {
  26333. var c = this.configs[i].semanticContext;
  26334. if (c !== SemanticContext.NONE) {
  26335. preds.push(c.semanticContext);
  26336. }
  26337. }
  26338. return preds;
  26339. };
  26340. Object.defineProperty(ATNConfigSet.prototype, "items", {
  26341. get: function get() {
  26342. return this.configs;
  26343. }
  26344. });
  26345. ATNConfigSet.prototype.optimizeConfigs = function (interpreter) {
  26346. if (this.readOnly) {
  26347. throw "This set is readonly";
  26348. }
  26349. if (this.configLookup.length === 0) {
  26350. return;
  26351. }
  26352. for (var i = 0; i < this.configs.length; i++) {
  26353. var config = this.configs[i];
  26354. config.context = interpreter.getCachedContext(config.context);
  26355. }
  26356. };
  26357. ATNConfigSet.prototype.addAll = function (coll) {
  26358. for (var i = 0; i < coll.length; i++) {
  26359. this.add(coll[i]);
  26360. }
  26361. return false;
  26362. };
  26363. ATNConfigSet.prototype.equals = function (other) {
  26364. 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;
  26365. };
  26366. ATNConfigSet.prototype.hashCode = function () {
  26367. var hash = new Hash();
  26368. this.updateHashCode(hash);
  26369. return hash.finish();
  26370. };
  26371. ATNConfigSet.prototype.updateHashCode = function (hash) {
  26372. if (this.readOnly) {
  26373. if (this.cachedHashCode === -1) {
  26374. var hash = new Hash();
  26375. hash.update(this.configs);
  26376. this.cachedHashCode = hash.finish();
  26377. }
  26378. hash.update(this.cachedHashCode);
  26379. } else {
  26380. hash.update(this.configs);
  26381. }
  26382. };
  26383. Object.defineProperty(ATNConfigSet.prototype, "length", {
  26384. get: function get() {
  26385. return this.configs.length;
  26386. }
  26387. });
  26388. ATNConfigSet.prototype.isEmpty = function () {
  26389. return this.configs.length === 0;
  26390. };
  26391. ATNConfigSet.prototype.contains = function (item) {
  26392. if (this.configLookup === null) {
  26393. throw "This method is not implemented for readonly sets.";
  26394. }
  26395. return this.configLookup.contains(item);
  26396. };
  26397. ATNConfigSet.prototype.containsFast = function (item) {
  26398. if (this.configLookup === null) {
  26399. throw "This method is not implemented for readonly sets.";
  26400. }
  26401. return this.configLookup.containsFast(item);
  26402. };
  26403. ATNConfigSet.prototype.clear = function () {
  26404. if (this.readOnly) {
  26405. throw "This set is readonly";
  26406. }
  26407. this.configs = [];
  26408. this.cachedHashCode = -1;
  26409. this.configLookup = new Set();
  26410. };
  26411. ATNConfigSet.prototype.setReadonly = function (readOnly) {
  26412. this.readOnly = readOnly;
  26413. if (readOnly) {
  26414. this.configLookup = null; // can't mod, no need for lookup cache
  26415. }
  26416. };
  26417. ATNConfigSet.prototype.toString = function () {
  26418. 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" : "");
  26419. };
  26420. function OrderedATNConfigSet() {
  26421. ATNConfigSet.call(this);
  26422. this.configLookup = new Set();
  26423. return this;
  26424. }
  26425. OrderedATNConfigSet.prototype = Object.create(ATNConfigSet.prototype);
  26426. OrderedATNConfigSet.prototype.constructor = OrderedATNConfigSet;
  26427. exports.ATNConfigSet = ATNConfigSet;
  26428. exports.OrderedATNConfigSet = OrderedATNConfigSet;
  26429. /***/ }),
  26430. /***/ "./node_modules/antlr4/atn/ATNDeserializationOptions.js":
  26431. /*!**************************************************************!*\
  26432. !*** ./node_modules/antlr4/atn/ATNDeserializationOptions.js ***!
  26433. \**************************************************************/
  26434. /*! no static exports found */
  26435. /***/ (function(module, exports, __webpack_require__) {
  26436. "use strict";
  26437. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  26438. * Use of this file is governed by the BSD 3-clause license that
  26439. * can be found in the LICENSE.txt file in the project root.
  26440. */
  26441. function ATNDeserializationOptions(copyFrom) {
  26442. if (copyFrom === undefined) {
  26443. copyFrom = null;
  26444. }
  26445. this.readOnly = false;
  26446. this.verifyATN = copyFrom === null ? true : copyFrom.verifyATN;
  26447. this.generateRuleBypassTransitions = copyFrom === null ? false : copyFrom.generateRuleBypassTransitions;
  26448. return this;
  26449. }
  26450. ATNDeserializationOptions.defaultOptions = new ATNDeserializationOptions();
  26451. ATNDeserializationOptions.defaultOptions.readOnly = true;
  26452. // def __setattr__(self, key, value):
  26453. // if key!="readOnly" and self.readOnly:
  26454. // raise Exception("The object is read only.")
  26455. // super(type(self), self).__setattr__(key,value)
  26456. exports.ATNDeserializationOptions = ATNDeserializationOptions;
  26457. /***/ }),
  26458. /***/ "./node_modules/antlr4/atn/ATNDeserializer.js":
  26459. /*!****************************************************!*\
  26460. !*** ./node_modules/antlr4/atn/ATNDeserializer.js ***!
  26461. \****************************************************/
  26462. /*! no static exports found */
  26463. /***/ (function(module, exports, __webpack_require__) {
  26464. "use strict";
  26465. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  26466. * Use of this file is governed by the BSD 3-clause license that
  26467. * can be found in the LICENSE.txt file in the project root.
  26468. */
  26469. var Token = __webpack_require__(/*! ./../Token */ "./node_modules/antlr4/Token.js").Token;
  26470. var ATN = __webpack_require__(/*! ./ATN */ "./node_modules/antlr4/atn/ATN.js").ATN;
  26471. var ATNType = __webpack_require__(/*! ./ATNType */ "./node_modules/antlr4/atn/ATNType.js").ATNType;
  26472. var ATNStates = __webpack_require__(/*! ./ATNState */ "./node_modules/antlr4/atn/ATNState.js");
  26473. var ATNState = ATNStates.ATNState;
  26474. var BasicState = ATNStates.BasicState;
  26475. var DecisionState = ATNStates.DecisionState;
  26476. var BlockStartState = ATNStates.BlockStartState;
  26477. var BlockEndState = ATNStates.BlockEndState;
  26478. var LoopEndState = ATNStates.LoopEndState;
  26479. var RuleStartState = ATNStates.RuleStartState;
  26480. var RuleStopState = ATNStates.RuleStopState;
  26481. var TokensStartState = ATNStates.TokensStartState;
  26482. var PlusLoopbackState = ATNStates.PlusLoopbackState;
  26483. var StarLoopbackState = ATNStates.StarLoopbackState;
  26484. var StarLoopEntryState = ATNStates.StarLoopEntryState;
  26485. var PlusBlockStartState = ATNStates.PlusBlockStartState;
  26486. var StarBlockStartState = ATNStates.StarBlockStartState;
  26487. var BasicBlockStartState = ATNStates.BasicBlockStartState;
  26488. var Transitions = __webpack_require__(/*! ./Transition */ "./node_modules/antlr4/atn/Transition.js");
  26489. var Transition = Transitions.Transition;
  26490. var AtomTransition = Transitions.AtomTransition;
  26491. var SetTransition = Transitions.SetTransition;
  26492. var NotSetTransition = Transitions.NotSetTransition;
  26493. var RuleTransition = Transitions.RuleTransition;
  26494. var RangeTransition = Transitions.RangeTransition;
  26495. var ActionTransition = Transitions.ActionTransition;
  26496. var EpsilonTransition = Transitions.EpsilonTransition;
  26497. var WildcardTransition = Transitions.WildcardTransition;
  26498. var PredicateTransition = Transitions.PredicateTransition;
  26499. var PrecedencePredicateTransition = Transitions.PrecedencePredicateTransition;
  26500. var IntervalSet = __webpack_require__(/*! ./../IntervalSet */ "./node_modules/antlr4/IntervalSet.js").IntervalSet;
  26501. var Interval = __webpack_require__(/*! ./../IntervalSet */ "./node_modules/antlr4/IntervalSet.js").Interval;
  26502. var ATNDeserializationOptions = __webpack_require__(/*! ./ATNDeserializationOptions */ "./node_modules/antlr4/atn/ATNDeserializationOptions.js").ATNDeserializationOptions;
  26503. var LexerActions = __webpack_require__(/*! ./LexerAction */ "./node_modules/antlr4/atn/LexerAction.js");
  26504. var LexerActionType = LexerActions.LexerActionType;
  26505. var LexerSkipAction = LexerActions.LexerSkipAction;
  26506. var LexerChannelAction = LexerActions.LexerChannelAction;
  26507. var LexerCustomAction = LexerActions.LexerCustomAction;
  26508. var LexerMoreAction = LexerActions.LexerMoreAction;
  26509. var LexerTypeAction = LexerActions.LexerTypeAction;
  26510. var LexerPushModeAction = LexerActions.LexerPushModeAction;
  26511. var LexerPopModeAction = LexerActions.LexerPopModeAction;
  26512. var LexerModeAction = LexerActions.LexerModeAction;
  26513. // This is the earliest supported serialized UUID.
  26514. // stick to serialized version for now, we don't need a UUID instance
  26515. var BASE_SERIALIZED_UUID = "AADB8D7E-AEEF-4415-AD2B-8204D6CF042E";
  26516. //
  26517. // This UUID indicates the serialized ATN contains two sets of
  26518. // IntervalSets, where the second set's values are encoded as
  26519. // 32-bit integers to support the full Unicode SMP range up to U+10FFFF.
  26520. //
  26521. var ADDED_UNICODE_SMP = "59627784-3BE5-417A-B9EB-8131A7286089";
  26522. // This list contains all of the currently supported UUIDs, ordered by when
  26523. // the feature first appeared in this branch.
  26524. var SUPPORTED_UUIDS = [BASE_SERIALIZED_UUID, ADDED_UNICODE_SMP];
  26525. var SERIALIZED_VERSION = 3;
  26526. // This is the current serialized UUID.
  26527. var SERIALIZED_UUID = ADDED_UNICODE_SMP;
  26528. function initArray(length, value) {
  26529. var tmp = [];
  26530. tmp[length - 1] = value;
  26531. return tmp.map(function (i) {
  26532. return value;
  26533. });
  26534. }
  26535. function ATNDeserializer(options) {
  26536. if (options === undefined || options === null) {
  26537. options = ATNDeserializationOptions.defaultOptions;
  26538. }
  26539. this.deserializationOptions = options;
  26540. this.stateFactories = null;
  26541. this.actionFactories = null;
  26542. return this;
  26543. }
  26544. // Determines if a particular serialized representation of an ATN supports
  26545. // a particular feature, identified by the {@link UUID} used for serializing
  26546. // the ATN at the time the feature was first introduced.
  26547. //
  26548. // @param feature The {@link UUID} marking the first time the feature was
  26549. // supported in the serialized ATN.
  26550. // @param actualUuid The {@link UUID} of the actual serialized ATN which is
  26551. // currently being deserialized.
  26552. // @return {@code true} if the {@code actualUuid} value represents a
  26553. // serialized ATN at or after the feature identified by {@code feature} was
  26554. // introduced; otherwise, {@code false}.
  26555. ATNDeserializer.prototype.isFeatureSupported = function (feature, actualUuid) {
  26556. var idx1 = SUPPORTED_UUIDS.indexOf(feature);
  26557. if (idx1 < 0) {
  26558. return false;
  26559. }
  26560. var idx2 = SUPPORTED_UUIDS.indexOf(actualUuid);
  26561. return idx2 >= idx1;
  26562. };
  26563. ATNDeserializer.prototype.deserialize = function (data) {
  26564. this.reset(data);
  26565. this.checkVersion();
  26566. this.checkUUID();
  26567. var atn = this.readATN();
  26568. this.readStates(atn);
  26569. this.readRules(atn);
  26570. this.readModes(atn);
  26571. var sets = [];
  26572. // First, deserialize sets with 16-bit arguments <= U+FFFF.
  26573. this.readSets(atn, sets, this.readInt.bind(this));
  26574. // Next, if the ATN was serialized with the Unicode SMP feature,
  26575. // deserialize sets with 32-bit arguments <= U+10FFFF.
  26576. if (this.isFeatureSupported(ADDED_UNICODE_SMP, this.uuid)) {
  26577. this.readSets(atn, sets, this.readInt32.bind(this));
  26578. }
  26579. this.readEdges(atn, sets);
  26580. this.readDecisions(atn);
  26581. this.readLexerActions(atn);
  26582. this.markPrecedenceDecisions(atn);
  26583. this.verifyATN(atn);
  26584. if (this.deserializationOptions.generateRuleBypassTransitions && atn.grammarType === ATNType.PARSER) {
  26585. this.generateRuleBypassTransitions(atn);
  26586. // re-verify after modification
  26587. this.verifyATN(atn);
  26588. }
  26589. return atn;
  26590. };
  26591. ATNDeserializer.prototype.reset = function (data) {
  26592. var adjust = function adjust(c) {
  26593. var v = c.charCodeAt(0);
  26594. return v > 1 ? v - 2 : v + 65533;
  26595. };
  26596. var temp = data.split("").map(adjust);
  26597. // don't adjust the first value since that's the version number
  26598. temp[0] = data.charCodeAt(0);
  26599. this.data = temp;
  26600. this.pos = 0;
  26601. };
  26602. ATNDeserializer.prototype.checkVersion = function () {
  26603. var version = this.readInt();
  26604. if (version !== SERIALIZED_VERSION) {
  26605. throw "Could not deserialize ATN with version " + version + " (expected " + SERIALIZED_VERSION + ").";
  26606. }
  26607. };
  26608. ATNDeserializer.prototype.checkUUID = function () {
  26609. var uuid = this.readUUID();
  26610. if (SUPPORTED_UUIDS.indexOf(uuid) < 0) {
  26611. throw "Could not deserialize ATN with UUID: " + uuid + " (expected " + SERIALIZED_UUID + " or a legacy UUID).", uuid, SERIALIZED_UUID;
  26612. }
  26613. this.uuid = uuid;
  26614. };
  26615. ATNDeserializer.prototype.readATN = function () {
  26616. var grammarType = this.readInt();
  26617. var maxTokenType = this.readInt();
  26618. return new ATN(grammarType, maxTokenType);
  26619. };
  26620. ATNDeserializer.prototype.readStates = function (atn) {
  26621. var j, pair, stateNumber;
  26622. var loopBackStateNumbers = [];
  26623. var endStateNumbers = [];
  26624. var nstates = this.readInt();
  26625. for (var i = 0; i < nstates; i++) {
  26626. var stype = this.readInt();
  26627. // ignore bad type of states
  26628. if (stype === ATNState.INVALID_TYPE) {
  26629. atn.addState(null);
  26630. continue;
  26631. }
  26632. var ruleIndex = this.readInt();
  26633. if (ruleIndex === 0xFFFF) {
  26634. ruleIndex = -1;
  26635. }
  26636. var s = this.stateFactory(stype, ruleIndex);
  26637. if (stype === ATNState.LOOP_END) {
  26638. // special case
  26639. var loopBackStateNumber = this.readInt();
  26640. loopBackStateNumbers.push([s, loopBackStateNumber]);
  26641. } else if (s instanceof BlockStartState) {
  26642. var endStateNumber = this.readInt();
  26643. endStateNumbers.push([s, endStateNumber]);
  26644. }
  26645. atn.addState(s);
  26646. }
  26647. // delay the assignment of loop back and end states until we know all the
  26648. // state instances have been initialized
  26649. for (j = 0; j < loopBackStateNumbers.length; j++) {
  26650. pair = loopBackStateNumbers[j];
  26651. pair[0].loopBackState = atn.states[pair[1]];
  26652. }
  26653. for (j = 0; j < endStateNumbers.length; j++) {
  26654. pair = endStateNumbers[j];
  26655. pair[0].endState = atn.states[pair[1]];
  26656. }
  26657. var numNonGreedyStates = this.readInt();
  26658. for (j = 0; j < numNonGreedyStates; j++) {
  26659. stateNumber = this.readInt();
  26660. atn.states[stateNumber].nonGreedy = true;
  26661. }
  26662. var numPrecedenceStates = this.readInt();
  26663. for (j = 0; j < numPrecedenceStates; j++) {
  26664. stateNumber = this.readInt();
  26665. atn.states[stateNumber].isPrecedenceRule = true;
  26666. }
  26667. };
  26668. ATNDeserializer.prototype.readRules = function (atn) {
  26669. var i;
  26670. var nrules = this.readInt();
  26671. if (atn.grammarType === ATNType.LEXER) {
  26672. atn.ruleToTokenType = initArray(nrules, 0);
  26673. }
  26674. atn.ruleToStartState = initArray(nrules, 0);
  26675. for (i = 0; i < nrules; i++) {
  26676. var s = this.readInt();
  26677. var startState = atn.states[s];
  26678. atn.ruleToStartState[i] = startState;
  26679. if (atn.grammarType === ATNType.LEXER) {
  26680. var tokenType = this.readInt();
  26681. if (tokenType === 0xFFFF) {
  26682. tokenType = Token.EOF;
  26683. }
  26684. atn.ruleToTokenType[i] = tokenType;
  26685. }
  26686. }
  26687. atn.ruleToStopState = initArray(nrules, 0);
  26688. for (i = 0; i < atn.states.length; i++) {
  26689. var state = atn.states[i];
  26690. if (!(state instanceof RuleStopState)) {
  26691. continue;
  26692. }
  26693. atn.ruleToStopState[state.ruleIndex] = state;
  26694. atn.ruleToStartState[state.ruleIndex].stopState = state;
  26695. }
  26696. };
  26697. ATNDeserializer.prototype.readModes = function (atn) {
  26698. var nmodes = this.readInt();
  26699. for (var i = 0; i < nmodes; i++) {
  26700. var s = this.readInt();
  26701. atn.modeToStartState.push(atn.states[s]);
  26702. }
  26703. };
  26704. ATNDeserializer.prototype.readSets = function (atn, sets, readUnicode) {
  26705. var m = this.readInt();
  26706. for (var i = 0; i < m; i++) {
  26707. var iset = new IntervalSet();
  26708. sets.push(iset);
  26709. var n = this.readInt();
  26710. var containsEof = this.readInt();
  26711. if (containsEof !== 0) {
  26712. iset.addOne(-1);
  26713. }
  26714. for (var j = 0; j < n; j++) {
  26715. var i1 = readUnicode();
  26716. var i2 = readUnicode();
  26717. iset.addRange(i1, i2);
  26718. }
  26719. }
  26720. };
  26721. ATNDeserializer.prototype.readEdges = function (atn, sets) {
  26722. var i, j, state, trans, target;
  26723. var nedges = this.readInt();
  26724. for (i = 0; i < nedges; i++) {
  26725. var src = this.readInt();
  26726. var trg = this.readInt();
  26727. var ttype = this.readInt();
  26728. var arg1 = this.readInt();
  26729. var arg2 = this.readInt();
  26730. var arg3 = this.readInt();
  26731. trans = this.edgeFactory(atn, ttype, src, trg, arg1, arg2, arg3, sets);
  26732. var srcState = atn.states[src];
  26733. srcState.addTransition(trans);
  26734. }
  26735. // edges for rule stop states can be derived, so they aren't serialized
  26736. for (i = 0; i < atn.states.length; i++) {
  26737. state = atn.states[i];
  26738. for (j = 0; j < state.transitions.length; j++) {
  26739. var t = state.transitions[j];
  26740. if (!(t instanceof RuleTransition)) {
  26741. continue;
  26742. }
  26743. var outermostPrecedenceReturn = -1;
  26744. if (atn.ruleToStartState[t.target.ruleIndex].isPrecedenceRule) {
  26745. if (t.precedence === 0) {
  26746. outermostPrecedenceReturn = t.target.ruleIndex;
  26747. }
  26748. }
  26749. trans = new EpsilonTransition(t.followState, outermostPrecedenceReturn);
  26750. atn.ruleToStopState[t.target.ruleIndex].addTransition(trans);
  26751. }
  26752. }
  26753. for (i = 0; i < atn.states.length; i++) {
  26754. state = atn.states[i];
  26755. if (state instanceof BlockStartState) {
  26756. // we need to know the end state to set its start state
  26757. if (state.endState === null) {
  26758. throw "IllegalState";
  26759. }
  26760. // block end states can only be associated to a single block start
  26761. // state
  26762. if (state.endState.startState !== null) {
  26763. throw "IllegalState";
  26764. }
  26765. state.endState.startState = state;
  26766. }
  26767. if (state instanceof PlusLoopbackState) {
  26768. for (j = 0; j < state.transitions.length; j++) {
  26769. target = state.transitions[j].target;
  26770. if (target instanceof PlusBlockStartState) {
  26771. target.loopBackState = state;
  26772. }
  26773. }
  26774. } else if (state instanceof StarLoopbackState) {
  26775. for (j = 0; j < state.transitions.length; j++) {
  26776. target = state.transitions[j].target;
  26777. if (target instanceof StarLoopEntryState) {
  26778. target.loopBackState = state;
  26779. }
  26780. }
  26781. }
  26782. }
  26783. };
  26784. ATNDeserializer.prototype.readDecisions = function (atn) {
  26785. var ndecisions = this.readInt();
  26786. for (var i = 0; i < ndecisions; i++) {
  26787. var s = this.readInt();
  26788. var decState = atn.states[s];
  26789. atn.decisionToState.push(decState);
  26790. decState.decision = i;
  26791. }
  26792. };
  26793. ATNDeserializer.prototype.readLexerActions = function (atn) {
  26794. if (atn.grammarType === ATNType.LEXER) {
  26795. var count = this.readInt();
  26796. atn.lexerActions = initArray(count, null);
  26797. for (var i = 0; i < count; i++) {
  26798. var actionType = this.readInt();
  26799. var data1 = this.readInt();
  26800. if (data1 === 0xFFFF) {
  26801. data1 = -1;
  26802. }
  26803. var data2 = this.readInt();
  26804. if (data2 === 0xFFFF) {
  26805. data2 = -1;
  26806. }
  26807. var lexerAction = this.lexerActionFactory(actionType, data1, data2);
  26808. atn.lexerActions[i] = lexerAction;
  26809. }
  26810. }
  26811. };
  26812. ATNDeserializer.prototype.generateRuleBypassTransitions = function (atn) {
  26813. var i;
  26814. var count = atn.ruleToStartState.length;
  26815. for (i = 0; i < count; i++) {
  26816. atn.ruleToTokenType[i] = atn.maxTokenType + i + 1;
  26817. }
  26818. for (i = 0; i < count; i++) {
  26819. this.generateRuleBypassTransition(atn, i);
  26820. }
  26821. };
  26822. ATNDeserializer.prototype.generateRuleBypassTransition = function (atn, idx) {
  26823. var i, state;
  26824. var bypassStart = new BasicBlockStartState();
  26825. bypassStart.ruleIndex = idx;
  26826. atn.addState(bypassStart);
  26827. var bypassStop = new BlockEndState();
  26828. bypassStop.ruleIndex = idx;
  26829. atn.addState(bypassStop);
  26830. bypassStart.endState = bypassStop;
  26831. atn.defineDecisionState(bypassStart);
  26832. bypassStop.startState = bypassStart;
  26833. var excludeTransition = null;
  26834. var endState = null;
  26835. if (atn.ruleToStartState[idx].isPrecedenceRule) {
  26836. // wrap from the beginning of the rule to the StarLoopEntryState
  26837. endState = null;
  26838. for (i = 0; i < atn.states.length; i++) {
  26839. state = atn.states[i];
  26840. if (this.stateIsEndStateFor(state, idx)) {
  26841. endState = state;
  26842. excludeTransition = state.loopBackState.transitions[0];
  26843. break;
  26844. }
  26845. }
  26846. if (excludeTransition === null) {
  26847. throw "Couldn't identify final state of the precedence rule prefix section.";
  26848. }
  26849. } else {
  26850. endState = atn.ruleToStopState[idx];
  26851. }
  26852. // all non-excluded transitions that currently target end state need to
  26853. // target blockEnd instead
  26854. for (i = 0; i < atn.states.length; i++) {
  26855. state = atn.states[i];
  26856. for (var j = 0; j < state.transitions.length; j++) {
  26857. var transition = state.transitions[j];
  26858. if (transition === excludeTransition) {
  26859. continue;
  26860. }
  26861. if (transition.target === endState) {
  26862. transition.target = bypassStop;
  26863. }
  26864. }
  26865. }
  26866. // all transitions leaving the rule start state need to leave blockStart
  26867. // instead
  26868. var ruleToStartState = atn.ruleToStartState[idx];
  26869. var count = ruleToStartState.transitions.length;
  26870. while (count > 0) {
  26871. bypassStart.addTransition(ruleToStartState.transitions[count - 1]);
  26872. ruleToStartState.transitions = ruleToStartState.transitions.slice(-1);
  26873. }
  26874. // link the new states
  26875. atn.ruleToStartState[idx].addTransition(new EpsilonTransition(bypassStart));
  26876. bypassStop.addTransition(new EpsilonTransition(endState));
  26877. var matchState = new BasicState();
  26878. atn.addState(matchState);
  26879. matchState.addTransition(new AtomTransition(bypassStop, atn.ruleToTokenType[idx]));
  26880. bypassStart.addTransition(new EpsilonTransition(matchState));
  26881. };
  26882. ATNDeserializer.prototype.stateIsEndStateFor = function (state, idx) {
  26883. if (state.ruleIndex !== idx) {
  26884. return null;
  26885. }
  26886. if (!(state instanceof StarLoopEntryState)) {
  26887. return null;
  26888. }
  26889. var maybeLoopEndState = state.transitions[state.transitions.length - 1].target;
  26890. if (!(maybeLoopEndState instanceof LoopEndState)) {
  26891. return null;
  26892. }
  26893. if (maybeLoopEndState.epsilonOnlyTransitions && maybeLoopEndState.transitions[0].target instanceof RuleStopState) {
  26894. return state;
  26895. } else {
  26896. return null;
  26897. }
  26898. };
  26899. //
  26900. // Analyze the {@link StarLoopEntryState} states in the specified ATN to set
  26901. // the {@link StarLoopEntryState//isPrecedenceDecision} field to the
  26902. // correct value.
  26903. //
  26904. // @param atn The ATN.
  26905. //
  26906. ATNDeserializer.prototype.markPrecedenceDecisions = function (atn) {
  26907. for (var i = 0; i < atn.states.length; i++) {
  26908. var state = atn.states[i];
  26909. if (!(state instanceof StarLoopEntryState)) {
  26910. continue;
  26911. }
  26912. // We analyze the ATN to determine if this ATN decision state is the
  26913. // decision for the closure block that determines whether a
  26914. // precedence rule should continue or complete.
  26915. //
  26916. if (atn.ruleToStartState[state.ruleIndex].isPrecedenceRule) {
  26917. var maybeLoopEndState = state.transitions[state.transitions.length - 1].target;
  26918. if (maybeLoopEndState instanceof LoopEndState) {
  26919. if (maybeLoopEndState.epsilonOnlyTransitions && maybeLoopEndState.transitions[0].target instanceof RuleStopState) {
  26920. state.isPrecedenceDecision = true;
  26921. }
  26922. }
  26923. }
  26924. }
  26925. };
  26926. ATNDeserializer.prototype.verifyATN = function (atn) {
  26927. if (!this.deserializationOptions.verifyATN) {
  26928. return;
  26929. }
  26930. // verify assumptions
  26931. for (var i = 0; i < atn.states.length; i++) {
  26932. var state = atn.states[i];
  26933. if (state === null) {
  26934. continue;
  26935. }
  26936. this.checkCondition(state.epsilonOnlyTransitions || state.transitions.length <= 1);
  26937. if (state instanceof PlusBlockStartState) {
  26938. this.checkCondition(state.loopBackState !== null);
  26939. } else if (state instanceof StarLoopEntryState) {
  26940. this.checkCondition(state.loopBackState !== null);
  26941. this.checkCondition(state.transitions.length === 2);
  26942. if (state.transitions[0].target instanceof StarBlockStartState) {
  26943. this.checkCondition(state.transitions[1].target instanceof LoopEndState);
  26944. this.checkCondition(!state.nonGreedy);
  26945. } else if (state.transitions[0].target instanceof LoopEndState) {
  26946. this.checkCondition(state.transitions[1].target instanceof StarBlockStartState);
  26947. this.checkCondition(state.nonGreedy);
  26948. } else {
  26949. throw "IllegalState";
  26950. }
  26951. } else if (state instanceof StarLoopbackState) {
  26952. this.checkCondition(state.transitions.length === 1);
  26953. this.checkCondition(state.transitions[0].target instanceof StarLoopEntryState);
  26954. } else if (state instanceof LoopEndState) {
  26955. this.checkCondition(state.loopBackState !== null);
  26956. } else if (state instanceof RuleStartState) {
  26957. this.checkCondition(state.stopState !== null);
  26958. } else if (state instanceof BlockStartState) {
  26959. this.checkCondition(state.endState !== null);
  26960. } else if (state instanceof BlockEndState) {
  26961. this.checkCondition(state.startState !== null);
  26962. } else if (state instanceof DecisionState) {
  26963. this.checkCondition(state.transitions.length <= 1 || state.decision >= 0);
  26964. } else {
  26965. this.checkCondition(state.transitions.length <= 1 || state instanceof RuleStopState);
  26966. }
  26967. }
  26968. };
  26969. ATNDeserializer.prototype.checkCondition = function (condition, message) {
  26970. if (!condition) {
  26971. if (message === undefined || message === null) {
  26972. message = "IllegalState";
  26973. }
  26974. throw message;
  26975. }
  26976. };
  26977. ATNDeserializer.prototype.readInt = function () {
  26978. return this.data[this.pos++];
  26979. };
  26980. ATNDeserializer.prototype.readInt32 = function () {
  26981. var low = this.readInt();
  26982. var high = this.readInt();
  26983. return low | high << 16;
  26984. };
  26985. ATNDeserializer.prototype.readLong = function () {
  26986. var low = this.readInt32();
  26987. var high = this.readInt32();
  26988. return low & 0x00000000FFFFFFFF | high << 32;
  26989. };
  26990. function createByteToHex() {
  26991. var bth = [];
  26992. for (var i = 0; i < 256; i++) {
  26993. bth[i] = (i + 0x100).toString(16).substr(1).toUpperCase();
  26994. }
  26995. return bth;
  26996. }
  26997. var byteToHex = createByteToHex();
  26998. ATNDeserializer.prototype.readUUID = function () {
  26999. var bb = [];
  27000. for (var i = 7; i >= 0; i--) {
  27001. var int = this.readInt();
  27002. /* jshint bitwise: false */
  27003. bb[2 * i + 1] = int & 0xFF;
  27004. bb[2 * i] = int >> 8 & 0xFF;
  27005. }
  27006. 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]];
  27007. };
  27008. ATNDeserializer.prototype.edgeFactory = function (atn, type, src, trg, arg1, arg2, arg3, sets) {
  27009. var target = atn.states[trg];
  27010. switch (type) {
  27011. case Transition.EPSILON:
  27012. return new EpsilonTransition(target);
  27013. case Transition.RANGE:
  27014. return arg3 !== 0 ? new RangeTransition(target, Token.EOF, arg2) : new RangeTransition(target, arg1, arg2);
  27015. case Transition.RULE:
  27016. return new RuleTransition(atn.states[arg1], arg2, arg3, target);
  27017. case Transition.PREDICATE:
  27018. return new PredicateTransition(target, arg1, arg2, arg3 !== 0);
  27019. case Transition.PRECEDENCE:
  27020. return new PrecedencePredicateTransition(target, arg1);
  27021. case Transition.ATOM:
  27022. return arg3 !== 0 ? new AtomTransition(target, Token.EOF) : new AtomTransition(target, arg1);
  27023. case Transition.ACTION:
  27024. return new ActionTransition(target, arg1, arg2, arg3 !== 0);
  27025. case Transition.SET:
  27026. return new SetTransition(target, sets[arg1]);
  27027. case Transition.NOT_SET:
  27028. return new NotSetTransition(target, sets[arg1]);
  27029. case Transition.WILDCARD:
  27030. return new WildcardTransition(target);
  27031. default:
  27032. throw "The specified transition type: " + type + " is not valid.";
  27033. }
  27034. };
  27035. ATNDeserializer.prototype.stateFactory = function (type, ruleIndex) {
  27036. if (this.stateFactories === null) {
  27037. var sf = [];
  27038. sf[ATNState.INVALID_TYPE] = null;
  27039. sf[ATNState.BASIC] = function () {
  27040. return new BasicState();
  27041. };
  27042. sf[ATNState.RULE_START] = function () {
  27043. return new RuleStartState();
  27044. };
  27045. sf[ATNState.BLOCK_START] = function () {
  27046. return new BasicBlockStartState();
  27047. };
  27048. sf[ATNState.PLUS_BLOCK_START] = function () {
  27049. return new PlusBlockStartState();
  27050. };
  27051. sf[ATNState.STAR_BLOCK_START] = function () {
  27052. return new StarBlockStartState();
  27053. };
  27054. sf[ATNState.TOKEN_START] = function () {
  27055. return new TokensStartState();
  27056. };
  27057. sf[ATNState.RULE_STOP] = function () {
  27058. return new RuleStopState();
  27059. };
  27060. sf[ATNState.BLOCK_END] = function () {
  27061. return new BlockEndState();
  27062. };
  27063. sf[ATNState.STAR_LOOP_BACK] = function () {
  27064. return new StarLoopbackState();
  27065. };
  27066. sf[ATNState.STAR_LOOP_ENTRY] = function () {
  27067. return new StarLoopEntryState();
  27068. };
  27069. sf[ATNState.PLUS_LOOP_BACK] = function () {
  27070. return new PlusLoopbackState();
  27071. };
  27072. sf[ATNState.LOOP_END] = function () {
  27073. return new LoopEndState();
  27074. };
  27075. this.stateFactories = sf;
  27076. }
  27077. if (type > this.stateFactories.length || this.stateFactories[type] === null) {
  27078. throw "The specified state type " + type + " is not valid.";
  27079. } else {
  27080. var s = this.stateFactories[type]();
  27081. if (s !== null) {
  27082. s.ruleIndex = ruleIndex;
  27083. return s;
  27084. }
  27085. }
  27086. };
  27087. ATNDeserializer.prototype.lexerActionFactory = function (type, data1, data2) {
  27088. if (this.actionFactories === null) {
  27089. var af = [];
  27090. af[LexerActionType.CHANNEL] = function (data1, data2) {
  27091. return new LexerChannelAction(data1);
  27092. };
  27093. af[LexerActionType.CUSTOM] = function (data1, data2) {
  27094. return new LexerCustomAction(data1, data2);
  27095. };
  27096. af[LexerActionType.MODE] = function (data1, data2) {
  27097. return new LexerModeAction(data1);
  27098. };
  27099. af[LexerActionType.MORE] = function (data1, data2) {
  27100. return LexerMoreAction.INSTANCE;
  27101. };
  27102. af[LexerActionType.POP_MODE] = function (data1, data2) {
  27103. return LexerPopModeAction.INSTANCE;
  27104. };
  27105. af[LexerActionType.PUSH_MODE] = function (data1, data2) {
  27106. return new LexerPushModeAction(data1);
  27107. };
  27108. af[LexerActionType.SKIP] = function (data1, data2) {
  27109. return LexerSkipAction.INSTANCE;
  27110. };
  27111. af[LexerActionType.TYPE] = function (data1, data2) {
  27112. return new LexerTypeAction(data1);
  27113. };
  27114. this.actionFactories = af;
  27115. }
  27116. if (type > this.actionFactories.length || this.actionFactories[type] === null) {
  27117. throw "The specified lexer action type " + type + " is not valid.";
  27118. } else {
  27119. return this.actionFactories[type](data1, data2);
  27120. }
  27121. };
  27122. exports.ATNDeserializer = ATNDeserializer;
  27123. /***/ }),
  27124. /***/ "./node_modules/antlr4/atn/ATNSimulator.js":
  27125. /*!*************************************************!*\
  27126. !*** ./node_modules/antlr4/atn/ATNSimulator.js ***!
  27127. \*************************************************/
  27128. /*! no static exports found */
  27129. /***/ (function(module, exports, __webpack_require__) {
  27130. "use strict";
  27131. //
  27132. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  27133. * Use of this file is governed by the BSD 3-clause license that
  27134. * can be found in the LICENSE.txt file in the project root.
  27135. */
  27136. ///
  27137. var DFAState = __webpack_require__(/*! ./../dfa/DFAState */ "./node_modules/antlr4/dfa/DFAState.js").DFAState;
  27138. var ATNConfigSet = __webpack_require__(/*! ./ATNConfigSet */ "./node_modules/antlr4/atn/ATNConfigSet.js").ATNConfigSet;
  27139. var getCachedPredictionContext = __webpack_require__(/*! ./../PredictionContext */ "./node_modules/antlr4/PredictionContext.js").getCachedPredictionContext;
  27140. function ATNSimulator(atn, sharedContextCache) {
  27141. // The context cache maps all PredictionContext objects that are ==
  27142. // to a single cached copy. This cache is shared across all contexts
  27143. // in all ATNConfigs in all DFA states. We rebuild each ATNConfigSet
  27144. // to use only cached nodes/graphs in addDFAState(). We don't want to
  27145. // fill this during closure() since there are lots of contexts that
  27146. // pop up but are not used ever again. It also greatly slows down closure().
  27147. //
  27148. // <p>This cache makes a huge difference in memory and a little bit in speed.
  27149. // For the Java grammar on java.*, it dropped the memory requirements
  27150. // at the end from 25M to 16M. We don't store any of the full context
  27151. // graphs in the DFA because they are limited to local context only,
  27152. // but apparently there's a lot of repetition there as well. We optimize
  27153. // the config contexts before storing the config set in the DFA states
  27154. // by literally rebuilding them with cached subgraphs only.</p>
  27155. //
  27156. // <p>I tried a cache for use during closure operations, that was
  27157. // whacked after each adaptivePredict(). It cost a little bit
  27158. // more time I think and doesn't save on the overall footprint
  27159. // so it's not worth the complexity.</p>
  27160. ///
  27161. this.atn = atn;
  27162. this.sharedContextCache = sharedContextCache;
  27163. return this;
  27164. }
  27165. // Must distinguish between missing edge and edge we know leads nowhere///
  27166. ATNSimulator.ERROR = new DFAState(0x7FFFFFFF, new ATNConfigSet());
  27167. ATNSimulator.prototype.getCachedContext = function (context) {
  27168. if (this.sharedContextCache === null) {
  27169. return context;
  27170. }
  27171. var visited = {};
  27172. return getCachedPredictionContext(context, this.sharedContextCache, visited);
  27173. };
  27174. exports.ATNSimulator = ATNSimulator;
  27175. /***/ }),
  27176. /***/ "./node_modules/antlr4/atn/ATNState.js":
  27177. /*!*********************************************!*\
  27178. !*** ./node_modules/antlr4/atn/ATNState.js ***!
  27179. \*********************************************/
  27180. /*! no static exports found */
  27181. /***/ (function(module, exports, __webpack_require__) {
  27182. "use strict";
  27183. //
  27184. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  27185. * Use of this file is governed by the BSD 3-clause license that
  27186. * can be found in the LICENSE.txt file in the project root.
  27187. */
  27188. //
  27189. // The following images show the relation of states and
  27190. // {@link ATNState//transitions} for various grammar constructs.
  27191. //
  27192. // <ul>
  27193. //
  27194. // <li>Solid edges marked with an &//0949; indicate a required
  27195. // {@link EpsilonTransition}.</li>
  27196. //
  27197. // <li>Dashed edges indicate locations where any transition derived from
  27198. // {@link Transition} might appear.</li>
  27199. //
  27200. // <li>Dashed nodes are place holders for either a sequence of linked
  27201. // {@link BasicState} states or the inclusion of a block representing a nested
  27202. // construct in one of the forms below.</li>
  27203. //
  27204. // <li>Nodes showing multiple outgoing alternatives with a {@code ...} support
  27205. // any number of alternatives (one or more). Nodes without the {@code ...} only
  27206. // support the exact number of alternatives shown in the diagram.</li>
  27207. //
  27208. // </ul>
  27209. //
  27210. // <h2>Basic Blocks</h2>
  27211. //
  27212. // <h3>Rule</h3>
  27213. //
  27214. // <embed src="images/Rule.svg" type="image/svg+xml"/>
  27215. //
  27216. // <h3>Block of 1 or more alternatives</h3>
  27217. //
  27218. // <embed src="images/Block.svg" type="image/svg+xml"/>
  27219. //
  27220. // <h2>Greedy Loops</h2>
  27221. //
  27222. // <h3>Greedy Closure: {@code (...)*}</h3>
  27223. //
  27224. // <embed src="images/ClosureGreedy.svg" type="image/svg+xml"/>
  27225. //
  27226. // <h3>Greedy Positive Closure: {@code (...)+}</h3>
  27227. //
  27228. // <embed src="images/PositiveClosureGreedy.svg" type="image/svg+xml"/>
  27229. //
  27230. // <h3>Greedy Optional: {@code (...)?}</h3>
  27231. //
  27232. // <embed src="images/OptionalGreedy.svg" type="image/svg+xml"/>
  27233. //
  27234. // <h2>Non-Greedy Loops</h2>
  27235. //
  27236. // <h3>Non-Greedy Closure: {@code (...)*?}</h3>
  27237. //
  27238. // <embed src="images/ClosureNonGreedy.svg" type="image/svg+xml"/>
  27239. //
  27240. // <h3>Non-Greedy Positive Closure: {@code (...)+?}</h3>
  27241. //
  27242. // <embed src="images/PositiveClosureNonGreedy.svg" type="image/svg+xml"/>
  27243. //
  27244. // <h3>Non-Greedy Optional: {@code (...)??}</h3>
  27245. //
  27246. // <embed src="images/OptionalNonGreedy.svg" type="image/svg+xml"/>
  27247. //
  27248. var INITIAL_NUM_TRANSITIONS = 4;
  27249. function ATNState() {
  27250. // Which ATN are we in?
  27251. this.atn = null;
  27252. this.stateNumber = ATNState.INVALID_STATE_NUMBER;
  27253. this.stateType = null;
  27254. this.ruleIndex = 0; // at runtime, we don't have Rule objects
  27255. this.epsilonOnlyTransitions = false;
  27256. // Track the transitions emanating from this ATN state.
  27257. this.transitions = [];
  27258. // Used to cache lookahead during parsing, not used during construction
  27259. this.nextTokenWithinRule = null;
  27260. return this;
  27261. }
  27262. // constants for serialization
  27263. ATNState.INVALID_TYPE = 0;
  27264. ATNState.BASIC = 1;
  27265. ATNState.RULE_START = 2;
  27266. ATNState.BLOCK_START = 3;
  27267. ATNState.PLUS_BLOCK_START = 4;
  27268. ATNState.STAR_BLOCK_START = 5;
  27269. ATNState.TOKEN_START = 6;
  27270. ATNState.RULE_STOP = 7;
  27271. ATNState.BLOCK_END = 8;
  27272. ATNState.STAR_LOOP_BACK = 9;
  27273. ATNState.STAR_LOOP_ENTRY = 10;
  27274. ATNState.PLUS_LOOP_BACK = 11;
  27275. ATNState.LOOP_END = 12;
  27276. 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"];
  27277. ATNState.INVALID_STATE_NUMBER = -1;
  27278. ATNState.prototype.toString = function () {
  27279. return this.stateNumber;
  27280. };
  27281. ATNState.prototype.equals = function (other) {
  27282. if (other instanceof ATNState) {
  27283. return this.stateNumber === other.stateNumber;
  27284. } else {
  27285. return false;
  27286. }
  27287. };
  27288. ATNState.prototype.isNonGreedyExitState = function () {
  27289. return false;
  27290. };
  27291. ATNState.prototype.addTransition = function (trans, index) {
  27292. if (index === undefined) {
  27293. index = -1;
  27294. }
  27295. if (this.transitions.length === 0) {
  27296. this.epsilonOnlyTransitions = trans.isEpsilon;
  27297. } else if (this.epsilonOnlyTransitions !== trans.isEpsilon) {
  27298. this.epsilonOnlyTransitions = false;
  27299. }
  27300. if (index === -1) {
  27301. this.transitions.push(trans);
  27302. } else {
  27303. this.transitions.splice(index, 1, trans);
  27304. }
  27305. };
  27306. function BasicState() {
  27307. ATNState.call(this);
  27308. this.stateType = ATNState.BASIC;
  27309. return this;
  27310. }
  27311. BasicState.prototype = Object.create(ATNState.prototype);
  27312. BasicState.prototype.constructor = BasicState;
  27313. function DecisionState() {
  27314. ATNState.call(this);
  27315. this.decision = -1;
  27316. this.nonGreedy = false;
  27317. return this;
  27318. }
  27319. DecisionState.prototype = Object.create(ATNState.prototype);
  27320. DecisionState.prototype.constructor = DecisionState;
  27321. // The start of a regular {@code (...)} block.
  27322. function BlockStartState() {
  27323. DecisionState.call(this);
  27324. this.endState = null;
  27325. return this;
  27326. }
  27327. BlockStartState.prototype = Object.create(DecisionState.prototype);
  27328. BlockStartState.prototype.constructor = BlockStartState;
  27329. function BasicBlockStartState() {
  27330. BlockStartState.call(this);
  27331. this.stateType = ATNState.BLOCK_START;
  27332. return this;
  27333. }
  27334. BasicBlockStartState.prototype = Object.create(BlockStartState.prototype);
  27335. BasicBlockStartState.prototype.constructor = BasicBlockStartState;
  27336. // Terminal node of a simple {@code (a|b|c)} block.
  27337. function BlockEndState() {
  27338. ATNState.call(this);
  27339. this.stateType = ATNState.BLOCK_END;
  27340. this.startState = null;
  27341. return this;
  27342. }
  27343. BlockEndState.prototype = Object.create(ATNState.prototype);
  27344. BlockEndState.prototype.constructor = BlockEndState;
  27345. // The last node in the ATN for a rule, unless that rule is the start symbol.
  27346. // In that case, there is one transition to EOF. Later, we might encode
  27347. // references to all calls to this rule to compute FOLLOW sets for
  27348. // error handling.
  27349. //
  27350. function RuleStopState() {
  27351. ATNState.call(this);
  27352. this.stateType = ATNState.RULE_STOP;
  27353. return this;
  27354. }
  27355. RuleStopState.prototype = Object.create(ATNState.prototype);
  27356. RuleStopState.prototype.constructor = RuleStopState;
  27357. function RuleStartState() {
  27358. ATNState.call(this);
  27359. this.stateType = ATNState.RULE_START;
  27360. this.stopState = null;
  27361. this.isPrecedenceRule = false;
  27362. return this;
  27363. }
  27364. RuleStartState.prototype = Object.create(ATNState.prototype);
  27365. RuleStartState.prototype.constructor = RuleStartState;
  27366. // Decision state for {@code A+} and {@code (A|B)+}. It has two transitions:
  27367. // one to the loop back to start of the block and one to exit.
  27368. //
  27369. function PlusLoopbackState() {
  27370. DecisionState.call(this);
  27371. this.stateType = ATNState.PLUS_LOOP_BACK;
  27372. return this;
  27373. }
  27374. PlusLoopbackState.prototype = Object.create(DecisionState.prototype);
  27375. PlusLoopbackState.prototype.constructor = PlusLoopbackState;
  27376. // Start of {@code (A|B|...)+} loop. Technically a decision state, but
  27377. // we don't use for code generation; somebody might need it, so I'm defining
  27378. // it for completeness. In reality, the {@link PlusLoopbackState} node is the
  27379. // real decision-making note for {@code A+}.
  27380. //
  27381. function PlusBlockStartState() {
  27382. BlockStartState.call(this);
  27383. this.stateType = ATNState.PLUS_BLOCK_START;
  27384. this.loopBackState = null;
  27385. return this;
  27386. }
  27387. PlusBlockStartState.prototype = Object.create(BlockStartState.prototype);
  27388. PlusBlockStartState.prototype.constructor = PlusBlockStartState;
  27389. // The block that begins a closure loop.
  27390. function StarBlockStartState() {
  27391. BlockStartState.call(this);
  27392. this.stateType = ATNState.STAR_BLOCK_START;
  27393. return this;
  27394. }
  27395. StarBlockStartState.prototype = Object.create(BlockStartState.prototype);
  27396. StarBlockStartState.prototype.constructor = StarBlockStartState;
  27397. function StarLoopbackState() {
  27398. ATNState.call(this);
  27399. this.stateType = ATNState.STAR_LOOP_BACK;
  27400. return this;
  27401. }
  27402. StarLoopbackState.prototype = Object.create(ATNState.prototype);
  27403. StarLoopbackState.prototype.constructor = StarLoopbackState;
  27404. function StarLoopEntryState() {
  27405. DecisionState.call(this);
  27406. this.stateType = ATNState.STAR_LOOP_ENTRY;
  27407. this.loopBackState = null;
  27408. // Indicates whether this state can benefit from a precedence DFA during SLL decision making.
  27409. this.isPrecedenceDecision = null;
  27410. return this;
  27411. }
  27412. StarLoopEntryState.prototype = Object.create(DecisionState.prototype);
  27413. StarLoopEntryState.prototype.constructor = StarLoopEntryState;
  27414. // Mark the end of a * or + loop.
  27415. function LoopEndState() {
  27416. ATNState.call(this);
  27417. this.stateType = ATNState.LOOP_END;
  27418. this.loopBackState = null;
  27419. return this;
  27420. }
  27421. LoopEndState.prototype = Object.create(ATNState.prototype);
  27422. LoopEndState.prototype.constructor = LoopEndState;
  27423. // The Tokens rule start state linking to each lexer rule start state */
  27424. function TokensStartState() {
  27425. DecisionState.call(this);
  27426. this.stateType = ATNState.TOKEN_START;
  27427. return this;
  27428. }
  27429. TokensStartState.prototype = Object.create(DecisionState.prototype);
  27430. TokensStartState.prototype.constructor = TokensStartState;
  27431. exports.ATNState = ATNState;
  27432. exports.BasicState = BasicState;
  27433. exports.DecisionState = DecisionState;
  27434. exports.BlockStartState = BlockStartState;
  27435. exports.BlockEndState = BlockEndState;
  27436. exports.LoopEndState = LoopEndState;
  27437. exports.RuleStartState = RuleStartState;
  27438. exports.RuleStopState = RuleStopState;
  27439. exports.TokensStartState = TokensStartState;
  27440. exports.PlusLoopbackState = PlusLoopbackState;
  27441. exports.StarLoopbackState = StarLoopbackState;
  27442. exports.StarLoopEntryState = StarLoopEntryState;
  27443. exports.PlusBlockStartState = PlusBlockStartState;
  27444. exports.StarBlockStartState = StarBlockStartState;
  27445. exports.BasicBlockStartState = BasicBlockStartState;
  27446. /***/ }),
  27447. /***/ "./node_modules/antlr4/atn/ATNType.js":
  27448. /*!********************************************!*\
  27449. !*** ./node_modules/antlr4/atn/ATNType.js ***!
  27450. \********************************************/
  27451. /*! no static exports found */
  27452. /***/ (function(module, exports, __webpack_require__) {
  27453. "use strict";
  27454. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  27455. * Use of this file is governed by the BSD 3-clause license that
  27456. * can be found in the LICENSE.txt file in the project root.
  27457. */
  27458. ///
  27459. // Represents the type of recognizer an ATN applies to.
  27460. function ATNType() {}
  27461. ATNType.LEXER = 0;
  27462. ATNType.PARSER = 1;
  27463. exports.ATNType = ATNType;
  27464. /***/ }),
  27465. /***/ "./node_modules/antlr4/atn/LexerATNSimulator.js":
  27466. /*!******************************************************!*\
  27467. !*** ./node_modules/antlr4/atn/LexerATNSimulator.js ***!
  27468. \******************************************************/
  27469. /*! no static exports found */
  27470. /***/ (function(module, exports, __webpack_require__) {
  27471. "use strict";
  27472. //
  27473. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  27474. * Use of this file is governed by the BSD 3-clause license that
  27475. * can be found in the LICENSE.txt file in the project root.
  27476. */
  27477. ///
  27478. // When we hit an accept state in either the DFA or the ATN, we
  27479. // have to notify the character stream to start buffering characters
  27480. // via {@link IntStream//mark} and record the current state. The current sim state
  27481. // includes the current index into the input, the current line,
  27482. // and current character position in that line. Note that the Lexer is
  27483. // tracking the starting line and characterization of the token. These
  27484. // variables track the "state" of the simulator when it hits an accept state.
  27485. //
  27486. // <p>We track these variables separately for the DFA and ATN simulation
  27487. // because the DFA simulation often has to fail over to the ATN
  27488. // simulation. If the ATN simulation fails, we need the DFA to fall
  27489. // back to its previously accepted state, if any. If the ATN succeeds,
  27490. // then the ATN does the accept and the DFA simulator that invoked it
  27491. // can simply return the predicted token type.</p>
  27492. ///
  27493. var Token = __webpack_require__(/*! ./../Token */ "./node_modules/antlr4/Token.js").Token;
  27494. var Lexer = __webpack_require__(/*! ./../Lexer */ "./node_modules/antlr4/Lexer.js").Lexer;
  27495. var ATN = __webpack_require__(/*! ./ATN */ "./node_modules/antlr4/atn/ATN.js").ATN;
  27496. var ATNSimulator = __webpack_require__(/*! ./ATNSimulator */ "./node_modules/antlr4/atn/ATNSimulator.js").ATNSimulator;
  27497. var DFAState = __webpack_require__(/*! ./../dfa/DFAState */ "./node_modules/antlr4/dfa/DFAState.js").DFAState;
  27498. var ATNConfigSet = __webpack_require__(/*! ./ATNConfigSet */ "./node_modules/antlr4/atn/ATNConfigSet.js").ATNConfigSet;
  27499. var OrderedATNConfigSet = __webpack_require__(/*! ./ATNConfigSet */ "./node_modules/antlr4/atn/ATNConfigSet.js").OrderedATNConfigSet;
  27500. var PredictionContext = __webpack_require__(/*! ./../PredictionContext */ "./node_modules/antlr4/PredictionContext.js").PredictionContext;
  27501. var SingletonPredictionContext = __webpack_require__(/*! ./../PredictionContext */ "./node_modules/antlr4/PredictionContext.js").SingletonPredictionContext;
  27502. var RuleStopState = __webpack_require__(/*! ./ATNState */ "./node_modules/antlr4/atn/ATNState.js").RuleStopState;
  27503. var LexerATNConfig = __webpack_require__(/*! ./ATNConfig */ "./node_modules/antlr4/atn/ATNConfig.js").LexerATNConfig;
  27504. var Transition = __webpack_require__(/*! ./Transition */ "./node_modules/antlr4/atn/Transition.js").Transition;
  27505. var LexerActionExecutor = __webpack_require__(/*! ./LexerActionExecutor */ "./node_modules/antlr4/atn/LexerActionExecutor.js").LexerActionExecutor;
  27506. var LexerNoViableAltException = __webpack_require__(/*! ./../error/Errors */ "./node_modules/antlr4/error/Errors.js").LexerNoViableAltException;
  27507. function resetSimState(sim) {
  27508. sim.index = -1;
  27509. sim.line = 0;
  27510. sim.column = -1;
  27511. sim.dfaState = null;
  27512. }
  27513. function SimState() {
  27514. resetSimState(this);
  27515. return this;
  27516. }
  27517. SimState.prototype.reset = function () {
  27518. resetSimState(this);
  27519. };
  27520. function LexerATNSimulator(recog, atn, decisionToDFA, sharedContextCache) {
  27521. ATNSimulator.call(this, atn, sharedContextCache);
  27522. this.decisionToDFA = decisionToDFA;
  27523. this.recog = recog;
  27524. // The current token's starting index into the character stream.
  27525. // Shared across DFA to ATN simulation in case the ATN fails and the
  27526. // DFA did not have a previous accept state. In this case, we use the
  27527. // ATN-generated exception object.
  27528. this.startIndex = -1;
  27529. // line number 1..n within the input///
  27530. this.line = 1;
  27531. // The index of the character relative to the beginning of the line
  27532. // 0..n-1///
  27533. this.column = 0;
  27534. this.mode = Lexer.DEFAULT_MODE;
  27535. // Used during DFA/ATN exec to record the most recent accept configuration
  27536. // info
  27537. this.prevAccept = new SimState();
  27538. // done
  27539. return this;
  27540. }
  27541. LexerATNSimulator.prototype = Object.create(ATNSimulator.prototype);
  27542. LexerATNSimulator.prototype.constructor = LexerATNSimulator;
  27543. LexerATNSimulator.debug = false;
  27544. LexerATNSimulator.dfa_debug = false;
  27545. LexerATNSimulator.MIN_DFA_EDGE = 0;
  27546. LexerATNSimulator.MAX_DFA_EDGE = 127; // forces unicode to stay in ATN
  27547. LexerATNSimulator.match_calls = 0;
  27548. LexerATNSimulator.prototype.copyState = function (simulator) {
  27549. this.column = simulator.column;
  27550. this.line = simulator.line;
  27551. this.mode = simulator.mode;
  27552. this.startIndex = simulator.startIndex;
  27553. };
  27554. LexerATNSimulator.prototype.match = function (input, mode) {
  27555. this.match_calls += 1;
  27556. this.mode = mode;
  27557. var mark = input.mark();
  27558. try {
  27559. this.startIndex = input.index;
  27560. this.prevAccept.reset();
  27561. var dfa = this.decisionToDFA[mode];
  27562. if (dfa.s0 === null) {
  27563. return this.matchATN(input);
  27564. } else {
  27565. return this.execATN(input, dfa.s0);
  27566. }
  27567. } finally {
  27568. input.release(mark);
  27569. }
  27570. };
  27571. LexerATNSimulator.prototype.reset = function () {
  27572. this.prevAccept.reset();
  27573. this.startIndex = -1;
  27574. this.line = 1;
  27575. this.column = 0;
  27576. this.mode = Lexer.DEFAULT_MODE;
  27577. };
  27578. LexerATNSimulator.prototype.matchATN = function (input) {
  27579. var startState = this.atn.modeToStartState[this.mode];
  27580. if (LexerATNSimulator.debug) {
  27581. console.log("matchATN mode " + this.mode + " start: " + startState);
  27582. }
  27583. var old_mode = this.mode;
  27584. var s0_closure = this.computeStartState(input, startState);
  27585. var suppressEdge = s0_closure.hasSemanticContext;
  27586. s0_closure.hasSemanticContext = false;
  27587. var next = this.addDFAState(s0_closure);
  27588. if (!suppressEdge) {
  27589. this.decisionToDFA[this.mode].s0 = next;
  27590. }
  27591. var predict = this.execATN(input, next);
  27592. if (LexerATNSimulator.debug) {
  27593. console.log("DFA after matchATN: " + this.decisionToDFA[old_mode].toLexerString());
  27594. }
  27595. return predict;
  27596. };
  27597. LexerATNSimulator.prototype.execATN = function (input, ds0) {
  27598. if (LexerATNSimulator.debug) {
  27599. console.log("start state closure=" + ds0.configs);
  27600. }
  27601. if (ds0.isAcceptState) {
  27602. // allow zero-length tokens
  27603. this.captureSimState(this.prevAccept, input, ds0);
  27604. }
  27605. var t = input.LA(1);
  27606. var s = ds0; // s is current/from DFA state
  27607. while (true) {
  27608. // while more work
  27609. if (LexerATNSimulator.debug) {
  27610. console.log("execATN loop starting closure: " + s.configs);
  27611. }
  27612. // As we move src->trg, src->trg, we keep track of the previous trg to
  27613. // avoid looking up the DFA state again, which is expensive.
  27614. // If the previous target was already part of the DFA, we might
  27615. // be able to avoid doing a reach operation upon t. If s!=null,
  27616. // it means that semantic predicates didn't prevent us from
  27617. // creating a DFA state. Once we know s!=null, we check to see if
  27618. // the DFA state has an edge already for t. If so, we can just reuse
  27619. // it's configuration set; there's no point in re-computing it.
  27620. // This is kind of like doing DFA simulation within the ATN
  27621. // simulation because DFA simulation is really just a way to avoid
  27622. // computing reach/closure sets. Technically, once we know that
  27623. // we have a previously added DFA state, we could jump over to
  27624. // the DFA simulator. But, that would mean popping back and forth
  27625. // a lot and making things more complicated algorithmically.
  27626. // This optimization makes a lot of sense for loops within DFA.
  27627. // A character will take us back to an existing DFA state
  27628. // that already has lots of edges out of it. e.g., .* in comments.
  27629. // print("Target for:" + str(s) + " and:" + str(t))
  27630. var target = this.getExistingTargetState(s, t);
  27631. // print("Existing:" + str(target))
  27632. if (target === null) {
  27633. target = this.computeTargetState(input, s, t);
  27634. // print("Computed:" + str(target))
  27635. }
  27636. if (target === ATNSimulator.ERROR) {
  27637. break;
  27638. }
  27639. // If this is a consumable input element, make sure to consume before
  27640. // capturing the accept state so the input index, line, and char
  27641. // position accurately reflect the state of the interpreter at the
  27642. // end of the token.
  27643. if (t !== Token.EOF) {
  27644. this.consume(input);
  27645. }
  27646. if (target.isAcceptState) {
  27647. this.captureSimState(this.prevAccept, input, target);
  27648. if (t === Token.EOF) {
  27649. break;
  27650. }
  27651. }
  27652. t = input.LA(1);
  27653. s = target; // flip; current DFA target becomes new src/from state
  27654. }
  27655. return this.failOrAccept(this.prevAccept, input, s.configs, t);
  27656. };
  27657. // Get an existing target state for an edge in the DFA. If the target state
  27658. // for the edge has not yet been computed or is otherwise not available,
  27659. // this method returns {@code null}.
  27660. //
  27661. // @param s The current DFA state
  27662. // @param t The next input symbol
  27663. // @return The existing target DFA state for the given input symbol
  27664. // {@code t}, or {@code null} if the target state for this edge is not
  27665. // already cached
  27666. LexerATNSimulator.prototype.getExistingTargetState = function (s, t) {
  27667. if (s.edges === null || t < LexerATNSimulator.MIN_DFA_EDGE || t > LexerATNSimulator.MAX_DFA_EDGE) {
  27668. return null;
  27669. }
  27670. var target = s.edges[t - LexerATNSimulator.MIN_DFA_EDGE];
  27671. if (target === undefined) {
  27672. target = null;
  27673. }
  27674. if (LexerATNSimulator.debug && target !== null) {
  27675. console.log("reuse state " + s.stateNumber + " edge to " + target.stateNumber);
  27676. }
  27677. return target;
  27678. };
  27679. // Compute a target state for an edge in the DFA, and attempt to add the
  27680. // computed state and corresponding edge to the DFA.
  27681. //
  27682. // @param input The input stream
  27683. // @param s The current DFA state
  27684. // @param t The next input symbol
  27685. //
  27686. // @return The computed target DFA state for the given input symbol
  27687. // {@code t}. If {@code t} does not lead to a valid DFA state, this method
  27688. // returns {@link //ERROR}.
  27689. LexerATNSimulator.prototype.computeTargetState = function (input, s, t) {
  27690. var reach = new OrderedATNConfigSet();
  27691. // if we don't find an existing DFA state
  27692. // Fill reach starting from closure, following t transitions
  27693. this.getReachableConfigSet(input, s.configs, reach, t);
  27694. if (reach.items.length === 0) {
  27695. // we got nowhere on t from s
  27696. if (!reach.hasSemanticContext) {
  27697. // we got nowhere on t, don't throw out this knowledge; it'd
  27698. // cause a failover from DFA later.
  27699. this.addDFAEdge(s, t, ATNSimulator.ERROR);
  27700. }
  27701. // stop when we can't match any more char
  27702. return ATNSimulator.ERROR;
  27703. }
  27704. // Add an edge from s to target DFA found/created for reach
  27705. return this.addDFAEdge(s, t, null, reach);
  27706. };
  27707. LexerATNSimulator.prototype.failOrAccept = function (prevAccept, input, reach, t) {
  27708. if (this.prevAccept.dfaState !== null) {
  27709. var lexerActionExecutor = prevAccept.dfaState.lexerActionExecutor;
  27710. this.accept(input, lexerActionExecutor, this.startIndex, prevAccept.index, prevAccept.line, prevAccept.column);
  27711. return prevAccept.dfaState.prediction;
  27712. } else {
  27713. // if no accept and EOF is first char, return EOF
  27714. if (t === Token.EOF && input.index === this.startIndex) {
  27715. return Token.EOF;
  27716. }
  27717. throw new LexerNoViableAltException(this.recog, input, this.startIndex, reach);
  27718. }
  27719. };
  27720. // Given a starting configuration set, figure out all ATN configurations
  27721. // we can reach upon input {@code t}. Parameter {@code reach} is a return
  27722. // parameter.
  27723. LexerATNSimulator.prototype.getReachableConfigSet = function (input, closure, reach, t) {
  27724. // this is used to skip processing for configs which have a lower priority
  27725. // than a config that already reached an accept state for the same rule
  27726. var skipAlt = ATN.INVALID_ALT_NUMBER;
  27727. for (var i = 0; i < closure.items.length; i++) {
  27728. var cfg = closure.items[i];
  27729. var currentAltReachedAcceptState = cfg.alt === skipAlt;
  27730. if (currentAltReachedAcceptState && cfg.passedThroughNonGreedyDecision) {
  27731. continue;
  27732. }
  27733. if (LexerATNSimulator.debug) {
  27734. console.log("testing %s at %s\n", this.getTokenName(t), cfg.toString(this.recog, true));
  27735. }
  27736. for (var j = 0; j < cfg.state.transitions.length; j++) {
  27737. var trans = cfg.state.transitions[j]; // for each transition
  27738. var target = this.getReachableTarget(trans, t);
  27739. if (target !== null) {
  27740. var lexerActionExecutor = cfg.lexerActionExecutor;
  27741. if (lexerActionExecutor !== null) {
  27742. lexerActionExecutor = lexerActionExecutor.fixOffsetBeforeMatch(input.index - this.startIndex);
  27743. }
  27744. var treatEofAsEpsilon = t === Token.EOF;
  27745. var config = new LexerATNConfig({ state: target, lexerActionExecutor: lexerActionExecutor }, cfg);
  27746. if (this.closure(input, config, reach, currentAltReachedAcceptState, true, treatEofAsEpsilon)) {
  27747. // any remaining configs for this alt have a lower priority
  27748. // than the one that just reached an accept state.
  27749. skipAlt = cfg.alt;
  27750. }
  27751. }
  27752. }
  27753. }
  27754. };
  27755. LexerATNSimulator.prototype.accept = function (input, lexerActionExecutor, startIndex, index, line, charPos) {
  27756. if (LexerATNSimulator.debug) {
  27757. console.log("ACTION %s\n", lexerActionExecutor);
  27758. }
  27759. // seek to after last char in token
  27760. input.seek(index);
  27761. this.line = line;
  27762. this.column = charPos;
  27763. if (lexerActionExecutor !== null && this.recog !== null) {
  27764. lexerActionExecutor.execute(this.recog, input, startIndex);
  27765. }
  27766. };
  27767. LexerATNSimulator.prototype.getReachableTarget = function (trans, t) {
  27768. if (trans.matches(t, 0, Lexer.MAX_CHAR_VALUE)) {
  27769. return trans.target;
  27770. } else {
  27771. return null;
  27772. }
  27773. };
  27774. LexerATNSimulator.prototype.computeStartState = function (input, p) {
  27775. var initialContext = PredictionContext.EMPTY;
  27776. var configs = new OrderedATNConfigSet();
  27777. for (var i = 0; i < p.transitions.length; i++) {
  27778. var target = p.transitions[i].target;
  27779. var cfg = new LexerATNConfig({ state: target, alt: i + 1, context: initialContext }, null);
  27780. this.closure(input, cfg, configs, false, false, false);
  27781. }
  27782. return configs;
  27783. };
  27784. // Since the alternatives within any lexer decision are ordered by
  27785. // preference, this method stops pursuing the closure as soon as an accept
  27786. // state is reached. After the first accept state is reached by depth-first
  27787. // search from {@code config}, all other (potentially reachable) states for
  27788. // this rule would have a lower priority.
  27789. //
  27790. // @return {@code true} if an accept state is reached, otherwise
  27791. // {@code false}.
  27792. LexerATNSimulator.prototype.closure = function (input, config, configs, currentAltReachedAcceptState, speculative, treatEofAsEpsilon) {
  27793. var cfg = null;
  27794. if (LexerATNSimulator.debug) {
  27795. console.log("closure(" + config.toString(this.recog, true) + ")");
  27796. }
  27797. if (config.state instanceof RuleStopState) {
  27798. if (LexerATNSimulator.debug) {
  27799. if (this.recog !== null) {
  27800. console.log("closure at %s rule stop %s\n", this.recog.ruleNames[config.state.ruleIndex], config);
  27801. } else {
  27802. console.log("closure at rule stop %s\n", config);
  27803. }
  27804. }
  27805. if (config.context === null || config.context.hasEmptyPath()) {
  27806. if (config.context === null || config.context.isEmpty()) {
  27807. configs.add(config);
  27808. return true;
  27809. } else {
  27810. configs.add(new LexerATNConfig({ state: config.state, context: PredictionContext.EMPTY }, config));
  27811. currentAltReachedAcceptState = true;
  27812. }
  27813. }
  27814. if (config.context !== null && !config.context.isEmpty()) {
  27815. for (var i = 0; i < config.context.length; i++) {
  27816. if (config.context.getReturnState(i) !== PredictionContext.EMPTY_RETURN_STATE) {
  27817. var newContext = config.context.getParent(i); // "pop" return state
  27818. var returnState = this.atn.states[config.context.getReturnState(i)];
  27819. cfg = new LexerATNConfig({ state: returnState, context: newContext }, config);
  27820. currentAltReachedAcceptState = this.closure(input, cfg, configs, currentAltReachedAcceptState, speculative, treatEofAsEpsilon);
  27821. }
  27822. }
  27823. }
  27824. return currentAltReachedAcceptState;
  27825. }
  27826. // optimization
  27827. if (!config.state.epsilonOnlyTransitions) {
  27828. if (!currentAltReachedAcceptState || !config.passedThroughNonGreedyDecision) {
  27829. configs.add(config);
  27830. }
  27831. }
  27832. for (var j = 0; j < config.state.transitions.length; j++) {
  27833. var trans = config.state.transitions[j];
  27834. cfg = this.getEpsilonTarget(input, config, trans, configs, speculative, treatEofAsEpsilon);
  27835. if (cfg !== null) {
  27836. currentAltReachedAcceptState = this.closure(input, cfg, configs, currentAltReachedAcceptState, speculative, treatEofAsEpsilon);
  27837. }
  27838. }
  27839. return currentAltReachedAcceptState;
  27840. };
  27841. // side-effect: can alter configs.hasSemanticContext
  27842. LexerATNSimulator.prototype.getEpsilonTarget = function (input, config, trans, configs, speculative, treatEofAsEpsilon) {
  27843. var cfg = null;
  27844. if (trans.serializationType === Transition.RULE) {
  27845. var newContext = SingletonPredictionContext.create(config.context, trans.followState.stateNumber);
  27846. cfg = new LexerATNConfig({ state: trans.target, context: newContext }, config);
  27847. } else if (trans.serializationType === Transition.PRECEDENCE) {
  27848. throw "Precedence predicates are not supported in lexers.";
  27849. } else if (trans.serializationType === Transition.PREDICATE) {
  27850. // Track traversing semantic predicates. If we traverse,
  27851. // we cannot add a DFA state for this "reach" computation
  27852. // because the DFA would not test the predicate again in the
  27853. // future. Rather than creating collections of semantic predicates
  27854. // like v3 and testing them on prediction, v4 will test them on the
  27855. // fly all the time using the ATN not the DFA. This is slower but
  27856. // semantically it's not used that often. One of the key elements to
  27857. // this predicate mechanism is not adding DFA states that see
  27858. // predicates immediately afterwards in the ATN. For example,
  27859. // a : ID {p1}? | ID {p2}? ;
  27860. // should create the start state for rule 'a' (to save start state
  27861. // competition), but should not create target of ID state. The
  27862. // collection of ATN states the following ID references includes
  27863. // states reached by traversing predicates. Since this is when we
  27864. // test them, we cannot cash the DFA state target of ID.
  27865. if (LexerATNSimulator.debug) {
  27866. console.log("EVAL rule " + trans.ruleIndex + ":" + trans.predIndex);
  27867. }
  27868. configs.hasSemanticContext = true;
  27869. if (this.evaluatePredicate(input, trans.ruleIndex, trans.predIndex, speculative)) {
  27870. cfg = new LexerATNConfig({ state: trans.target }, config);
  27871. }
  27872. } else if (trans.serializationType === Transition.ACTION) {
  27873. if (config.context === null || config.context.hasEmptyPath()) {
  27874. // execute actions anywhere in the start rule for a token.
  27875. //
  27876. // TODO: if the entry rule is invoked recursively, some
  27877. // actions may be executed during the recursive call. The
  27878. // problem can appear when hasEmptyPath() is true but
  27879. // isEmpty() is false. In this case, the config needs to be
  27880. // split into two contexts - one with just the empty path
  27881. // and another with everything but the empty path.
  27882. // Unfortunately, the current algorithm does not allow
  27883. // getEpsilonTarget to return two configurations, so
  27884. // additional modifications are needed before we can support
  27885. // the split operation.
  27886. var lexerActionExecutor = LexerActionExecutor.append(config.lexerActionExecutor, this.atn.lexerActions[trans.actionIndex]);
  27887. cfg = new LexerATNConfig({ state: trans.target, lexerActionExecutor: lexerActionExecutor }, config);
  27888. } else {
  27889. // ignore actions in referenced rules
  27890. cfg = new LexerATNConfig({ state: trans.target }, config);
  27891. }
  27892. } else if (trans.serializationType === Transition.EPSILON) {
  27893. cfg = new LexerATNConfig({ state: trans.target }, config);
  27894. } else if (trans.serializationType === Transition.ATOM || trans.serializationType === Transition.RANGE || trans.serializationType === Transition.SET) {
  27895. if (treatEofAsEpsilon) {
  27896. if (trans.matches(Token.EOF, 0, Lexer.MAX_CHAR_VALUE)) {
  27897. cfg = new LexerATNConfig({ state: trans.target }, config);
  27898. }
  27899. }
  27900. }
  27901. return cfg;
  27902. };
  27903. // Evaluate a predicate specified in the lexer.
  27904. //
  27905. // <p>If {@code speculative} is {@code true}, this method was called before
  27906. // {@link //consume} for the matched character. This method should call
  27907. // {@link //consume} before evaluating the predicate to ensure position
  27908. // sensitive values, including {@link Lexer//getText}, {@link Lexer//getLine},
  27909. // and {@link Lexer//getcolumn}, properly reflect the current
  27910. // lexer state. This method should restore {@code input} and the simulator
  27911. // to the original state before returning (i.e. undo the actions made by the
  27912. // call to {@link //consume}.</p>
  27913. //
  27914. // @param input The input stream.
  27915. // @param ruleIndex The rule containing the predicate.
  27916. // @param predIndex The index of the predicate within the rule.
  27917. // @param speculative {@code true} if the current index in {@code input} is
  27918. // one character before the predicate's location.
  27919. //
  27920. // @return {@code true} if the specified predicate evaluates to
  27921. // {@code true}.
  27922. // /
  27923. LexerATNSimulator.prototype.evaluatePredicate = function (input, ruleIndex, predIndex, speculative) {
  27924. // assume true if no recognizer was provided
  27925. if (this.recog === null) {
  27926. return true;
  27927. }
  27928. if (!speculative) {
  27929. return this.recog.sempred(null, ruleIndex, predIndex);
  27930. }
  27931. var savedcolumn = this.column;
  27932. var savedLine = this.line;
  27933. var index = input.index;
  27934. var marker = input.mark();
  27935. try {
  27936. this.consume(input);
  27937. return this.recog.sempred(null, ruleIndex, predIndex);
  27938. } finally {
  27939. this.column = savedcolumn;
  27940. this.line = savedLine;
  27941. input.seek(index);
  27942. input.release(marker);
  27943. }
  27944. };
  27945. LexerATNSimulator.prototype.captureSimState = function (settings, input, dfaState) {
  27946. settings.index = input.index;
  27947. settings.line = this.line;
  27948. settings.column = this.column;
  27949. settings.dfaState = dfaState;
  27950. };
  27951. LexerATNSimulator.prototype.addDFAEdge = function (from_, tk, to, cfgs) {
  27952. if (to === undefined) {
  27953. to = null;
  27954. }
  27955. if (cfgs === undefined) {
  27956. cfgs = null;
  27957. }
  27958. if (to === null && cfgs !== null) {
  27959. // leading to this call, ATNConfigSet.hasSemanticContext is used as a
  27960. // marker indicating dynamic predicate evaluation makes this edge
  27961. // dependent on the specific input sequence, so the static edge in the
  27962. // DFA should be omitted. The target DFAState is still created since
  27963. // execATN has the ability to resynchronize with the DFA state cache
  27964. // following the predicate evaluation step.
  27965. //
  27966. // TJP notes: next time through the DFA, we see a pred again and eval.
  27967. // If that gets us to a previously created (but dangling) DFA
  27968. // state, we can continue in pure DFA mode from there.
  27969. // /
  27970. var suppressEdge = cfgs.hasSemanticContext;
  27971. cfgs.hasSemanticContext = false;
  27972. to = this.addDFAState(cfgs);
  27973. if (suppressEdge) {
  27974. return to;
  27975. }
  27976. }
  27977. // add the edge
  27978. if (tk < LexerATNSimulator.MIN_DFA_EDGE || tk > LexerATNSimulator.MAX_DFA_EDGE) {
  27979. // Only track edges within the DFA bounds
  27980. return to;
  27981. }
  27982. if (LexerATNSimulator.debug) {
  27983. console.log("EDGE " + from_ + " -> " + to + " upon " + tk);
  27984. }
  27985. if (from_.edges === null) {
  27986. // make room for tokens 1..n and -1 masquerading as index 0
  27987. from_.edges = [];
  27988. }
  27989. from_.edges[tk - LexerATNSimulator.MIN_DFA_EDGE] = to; // connect
  27990. return to;
  27991. };
  27992. // Add a new DFA state if there isn't one with this set of
  27993. // configurations already. This method also detects the first
  27994. // configuration containing an ATN rule stop state. Later, when
  27995. // traversing the DFA, we will know which rule to accept.
  27996. LexerATNSimulator.prototype.addDFAState = function (configs) {
  27997. var proposed = new DFAState(null, configs);
  27998. var firstConfigWithRuleStopState = null;
  27999. for (var i = 0; i < configs.items.length; i++) {
  28000. var cfg = configs.items[i];
  28001. if (cfg.state instanceof RuleStopState) {
  28002. firstConfigWithRuleStopState = cfg;
  28003. break;
  28004. }
  28005. }
  28006. if (firstConfigWithRuleStopState !== null) {
  28007. proposed.isAcceptState = true;
  28008. proposed.lexerActionExecutor = firstConfigWithRuleStopState.lexerActionExecutor;
  28009. proposed.prediction = this.atn.ruleToTokenType[firstConfigWithRuleStopState.state.ruleIndex];
  28010. }
  28011. var dfa = this.decisionToDFA[this.mode];
  28012. var existing = dfa.states.get(proposed);
  28013. if (existing !== null) {
  28014. return existing;
  28015. }
  28016. var newState = proposed;
  28017. newState.stateNumber = dfa.states.length;
  28018. configs.setReadonly(true);
  28019. newState.configs = configs;
  28020. dfa.states.add(newState);
  28021. return newState;
  28022. };
  28023. LexerATNSimulator.prototype.getDFA = function (mode) {
  28024. return this.decisionToDFA[mode];
  28025. };
  28026. // Get the text matched so far for the current token.
  28027. LexerATNSimulator.prototype.getText = function (input) {
  28028. // index is first lookahead char, don't include.
  28029. return input.getText(this.startIndex, input.index - 1);
  28030. };
  28031. LexerATNSimulator.prototype.consume = function (input) {
  28032. var curChar = input.LA(1);
  28033. if (curChar === "\n".charCodeAt(0)) {
  28034. this.line += 1;
  28035. this.column = 0;
  28036. } else {
  28037. this.column += 1;
  28038. }
  28039. input.consume();
  28040. };
  28041. LexerATNSimulator.prototype.getTokenName = function (tt) {
  28042. if (tt === -1) {
  28043. return "EOF";
  28044. } else {
  28045. return "'" + String.fromCharCode(tt) + "'";
  28046. }
  28047. };
  28048. exports.LexerATNSimulator = LexerATNSimulator;
  28049. /***/ }),
  28050. /***/ "./node_modules/antlr4/atn/LexerAction.js":
  28051. /*!************************************************!*\
  28052. !*** ./node_modules/antlr4/atn/LexerAction.js ***!
  28053. \************************************************/
  28054. /*! no static exports found */
  28055. /***/ (function(module, exports, __webpack_require__) {
  28056. "use strict";
  28057. //
  28058. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  28059. * Use of this file is governed by the BSD 3-clause license that
  28060. * can be found in the LICENSE.txt file in the project root.
  28061. */
  28062. //
  28063. function LexerActionType() {}
  28064. LexerActionType.CHANNEL = 0; //The type of a {@link LexerChannelAction} action.
  28065. LexerActionType.CUSTOM = 1; //The type of a {@link LexerCustomAction} action.
  28066. LexerActionType.MODE = 2; //The type of a {@link LexerModeAction} action.
  28067. LexerActionType.MORE = 3; //The type of a {@link LexerMoreAction} action.
  28068. LexerActionType.POP_MODE = 4; //The type of a {@link LexerPopModeAction} action.
  28069. LexerActionType.PUSH_MODE = 5; //The type of a {@link LexerPushModeAction} action.
  28070. LexerActionType.SKIP = 6; //The type of a {@link LexerSkipAction} action.
  28071. LexerActionType.TYPE = 7; //The type of a {@link LexerTypeAction} action.
  28072. function LexerAction(action) {
  28073. this.actionType = action;
  28074. this.isPositionDependent = false;
  28075. return this;
  28076. }
  28077. LexerAction.prototype.hashCode = function () {
  28078. var hash = new Hash();
  28079. this.updateHashCode(hash);
  28080. return hash.finish();
  28081. };
  28082. LexerAction.prototype.updateHashCode = function (hash) {
  28083. hash.update(this.actionType);
  28084. };
  28085. LexerAction.prototype.equals = function (other) {
  28086. return this === other;
  28087. };
  28088. //
  28089. // Implements the {@code skip} lexer action by calling {@link Lexer//skip}.
  28090. //
  28091. // <p>The {@code skip} command does not have any parameters, so this action is
  28092. // implemented as a singleton instance exposed by {@link //INSTANCE}.</p>
  28093. function LexerSkipAction() {
  28094. LexerAction.call(this, LexerActionType.SKIP);
  28095. return this;
  28096. }
  28097. LexerSkipAction.prototype = Object.create(LexerAction.prototype);
  28098. LexerSkipAction.prototype.constructor = LexerSkipAction;
  28099. // Provides a singleton instance of this parameterless lexer action.
  28100. LexerSkipAction.INSTANCE = new LexerSkipAction();
  28101. LexerSkipAction.prototype.execute = function (lexer) {
  28102. lexer.skip();
  28103. };
  28104. LexerSkipAction.prototype.toString = function () {
  28105. return "skip";
  28106. };
  28107. // Implements the {@code type} lexer action by calling {@link Lexer//setType}
  28108. // with the assigned type.
  28109. function LexerTypeAction(type) {
  28110. LexerAction.call(this, LexerActionType.TYPE);
  28111. this.type = type;
  28112. return this;
  28113. }
  28114. LexerTypeAction.prototype = Object.create(LexerAction.prototype);
  28115. LexerTypeAction.prototype.constructor = LexerTypeAction;
  28116. LexerTypeAction.prototype.execute = function (lexer) {
  28117. lexer.type = this.type;
  28118. };
  28119. LexerTypeAction.prototype.updateHashCode = function (hash) {
  28120. hash.update(this.actionType, this.type);
  28121. };
  28122. LexerTypeAction.prototype.equals = function (other) {
  28123. if (this === other) {
  28124. return true;
  28125. } else if (!(other instanceof LexerTypeAction)) {
  28126. return false;
  28127. } else {
  28128. return this.type === other.type;
  28129. }
  28130. };
  28131. LexerTypeAction.prototype.toString = function () {
  28132. return "type(" + this.type + ")";
  28133. };
  28134. // Implements the {@code pushMode} lexer action by calling
  28135. // {@link Lexer//pushMode} with the assigned mode.
  28136. function LexerPushModeAction(mode) {
  28137. LexerAction.call(this, LexerActionType.PUSH_MODE);
  28138. this.mode = mode;
  28139. return this;
  28140. }
  28141. LexerPushModeAction.prototype = Object.create(LexerAction.prototype);
  28142. LexerPushModeAction.prototype.constructor = LexerPushModeAction;
  28143. // <p>This action is implemented by calling {@link Lexer//pushMode} with the
  28144. // value provided by {@link //getMode}.</p>
  28145. LexerPushModeAction.prototype.execute = function (lexer) {
  28146. lexer.pushMode(this.mode);
  28147. };
  28148. LexerPushModeAction.prototype.updateHashCode = function (hash) {
  28149. hash.update(this.actionType, this.mode);
  28150. };
  28151. LexerPushModeAction.prototype.equals = function (other) {
  28152. if (this === other) {
  28153. return true;
  28154. } else if (!(other instanceof LexerPushModeAction)) {
  28155. return false;
  28156. } else {
  28157. return this.mode === other.mode;
  28158. }
  28159. };
  28160. LexerPushModeAction.prototype.toString = function () {
  28161. return "pushMode(" + this.mode + ")";
  28162. };
  28163. // Implements the {@code popMode} lexer action by calling {@link Lexer//popMode}.
  28164. //
  28165. // <p>The {@code popMode} command does not have any parameters, so this action is
  28166. // implemented as a singleton instance exposed by {@link //INSTANCE}.</p>
  28167. function LexerPopModeAction() {
  28168. LexerAction.call(this, LexerActionType.POP_MODE);
  28169. return this;
  28170. }
  28171. LexerPopModeAction.prototype = Object.create(LexerAction.prototype);
  28172. LexerPopModeAction.prototype.constructor = LexerPopModeAction;
  28173. LexerPopModeAction.INSTANCE = new LexerPopModeAction();
  28174. // <p>This action is implemented by calling {@link Lexer//popMode}.</p>
  28175. LexerPopModeAction.prototype.execute = function (lexer) {
  28176. lexer.popMode();
  28177. };
  28178. LexerPopModeAction.prototype.toString = function () {
  28179. return "popMode";
  28180. };
  28181. // Implements the {@code more} lexer action by calling {@link Lexer//more}.
  28182. //
  28183. // <p>The {@code more} command does not have any parameters, so this action is
  28184. // implemented as a singleton instance exposed by {@link //INSTANCE}.</p>
  28185. function LexerMoreAction() {
  28186. LexerAction.call(this, LexerActionType.MORE);
  28187. return this;
  28188. }
  28189. LexerMoreAction.prototype = Object.create(LexerAction.prototype);
  28190. LexerMoreAction.prototype.constructor = LexerMoreAction;
  28191. LexerMoreAction.INSTANCE = new LexerMoreAction();
  28192. // <p>This action is implemented by calling {@link Lexer//popMode}.</p>
  28193. LexerMoreAction.prototype.execute = function (lexer) {
  28194. lexer.more();
  28195. };
  28196. LexerMoreAction.prototype.toString = function () {
  28197. return "more";
  28198. };
  28199. // Implements the {@code mode} lexer action by calling {@link Lexer//mode} with
  28200. // the assigned mode.
  28201. function LexerModeAction(mode) {
  28202. LexerAction.call(this, LexerActionType.MODE);
  28203. this.mode = mode;
  28204. return this;
  28205. }
  28206. LexerModeAction.prototype = Object.create(LexerAction.prototype);
  28207. LexerModeAction.prototype.constructor = LexerModeAction;
  28208. // <p>This action is implemented by calling {@link Lexer//mode} with the
  28209. // value provided by {@link //getMode}.</p>
  28210. LexerModeAction.prototype.execute = function (lexer) {
  28211. lexer.mode(this.mode);
  28212. };
  28213. LexerModeAction.prototype.updateHashCode = function (hash) {
  28214. hash.update(this.actionType, this.mode);
  28215. };
  28216. LexerModeAction.prototype.equals = function (other) {
  28217. if (this === other) {
  28218. return true;
  28219. } else if (!(other instanceof LexerModeAction)) {
  28220. return false;
  28221. } else {
  28222. return this.mode === other.mode;
  28223. }
  28224. };
  28225. LexerModeAction.prototype.toString = function () {
  28226. return "mode(" + this.mode + ")";
  28227. };
  28228. // Executes a custom lexer action by calling {@link Recognizer//action} with the
  28229. // rule and action indexes assigned to the custom action. The implementation of
  28230. // a custom action is added to the generated code for the lexer in an override
  28231. // of {@link Recognizer//action} when the grammar is compiled.
  28232. //
  28233. // <p>This class may represent embedded actions created with the <code>{...}</code>
  28234. // syntax in ANTLR 4, as well as actions created for lexer commands where the
  28235. // command argument could not be evaluated when the grammar was compiled.</p>
  28236. // Constructs a custom lexer action with the specified rule and action
  28237. // indexes.
  28238. //
  28239. // @param ruleIndex The rule index to use for calls to
  28240. // {@link Recognizer//action}.
  28241. // @param actionIndex The action index to use for calls to
  28242. // {@link Recognizer//action}.
  28243. function LexerCustomAction(ruleIndex, actionIndex) {
  28244. LexerAction.call(this, LexerActionType.CUSTOM);
  28245. this.ruleIndex = ruleIndex;
  28246. this.actionIndex = actionIndex;
  28247. this.isPositionDependent = true;
  28248. return this;
  28249. }
  28250. LexerCustomAction.prototype = Object.create(LexerAction.prototype);
  28251. LexerCustomAction.prototype.constructor = LexerCustomAction;
  28252. // <p>Custom actions are implemented by calling {@link Lexer//action} with the
  28253. // appropriate rule and action indexes.</p>
  28254. LexerCustomAction.prototype.execute = function (lexer) {
  28255. lexer.action(null, this.ruleIndex, this.actionIndex);
  28256. };
  28257. LexerCustomAction.prototype.updateHashCode = function (hash) {
  28258. hash.update(this.actionType, this.ruleIndex, this.actionIndex);
  28259. };
  28260. LexerCustomAction.prototype.equals = function (other) {
  28261. if (this === other) {
  28262. return true;
  28263. } else if (!(other instanceof LexerCustomAction)) {
  28264. return false;
  28265. } else {
  28266. return this.ruleIndex === other.ruleIndex && this.actionIndex === other.actionIndex;
  28267. }
  28268. };
  28269. // Implements the {@code channel} lexer action by calling
  28270. // {@link Lexer//setChannel} with the assigned channel.
  28271. // Constructs a new {@code channel} action with the specified channel value.
  28272. // @param channel The channel value to pass to {@link Lexer//setChannel}.
  28273. function LexerChannelAction(channel) {
  28274. LexerAction.call(this, LexerActionType.CHANNEL);
  28275. this.channel = channel;
  28276. return this;
  28277. }
  28278. LexerChannelAction.prototype = Object.create(LexerAction.prototype);
  28279. LexerChannelAction.prototype.constructor = LexerChannelAction;
  28280. // <p>This action is implemented by calling {@link Lexer//setChannel} with the
  28281. // value provided by {@link //getChannel}.</p>
  28282. LexerChannelAction.prototype.execute = function (lexer) {
  28283. lexer._channel = this.channel;
  28284. };
  28285. LexerChannelAction.prototype.updateHashCode = function (hash) {
  28286. hash.update(this.actionType, this.channel);
  28287. };
  28288. LexerChannelAction.prototype.equals = function (other) {
  28289. if (this === other) {
  28290. return true;
  28291. } else if (!(other instanceof LexerChannelAction)) {
  28292. return false;
  28293. } else {
  28294. return this.channel === other.channel;
  28295. }
  28296. };
  28297. LexerChannelAction.prototype.toString = function () {
  28298. return "channel(" + this.channel + ")";
  28299. };
  28300. // This implementation of {@link LexerAction} is used for tracking input offsets
  28301. // for position-dependent actions within a {@link LexerActionExecutor}.
  28302. //
  28303. // <p>This action is not serialized as part of the ATN, and is only required for
  28304. // position-dependent lexer actions which appear at a location other than the
  28305. // end of a rule. For more information about DFA optimizations employed for
  28306. // lexer actions, see {@link LexerActionExecutor//append} and
  28307. // {@link LexerActionExecutor//fixOffsetBeforeMatch}.</p>
  28308. // Constructs a new indexed custom action by associating a character offset
  28309. // with a {@link LexerAction}.
  28310. //
  28311. // <p>Note: This class is only required for lexer actions for which
  28312. // {@link LexerAction//isPositionDependent} returns {@code true}.</p>
  28313. //
  28314. // @param offset The offset into the input {@link CharStream}, relative to
  28315. // the token start index, at which the specified lexer action should be
  28316. // executed.
  28317. // @param action The lexer action to execute at a particular offset in the
  28318. // input {@link CharStream}.
  28319. function LexerIndexedCustomAction(offset, action) {
  28320. LexerAction.call(this, action.actionType);
  28321. this.offset = offset;
  28322. this.action = action;
  28323. this.isPositionDependent = true;
  28324. return this;
  28325. }
  28326. LexerIndexedCustomAction.prototype = Object.create(LexerAction.prototype);
  28327. LexerIndexedCustomAction.prototype.constructor = LexerIndexedCustomAction;
  28328. // <p>This method calls {@link //execute} on the result of {@link //getAction}
  28329. // using the provided {@code lexer}.</p>
  28330. LexerIndexedCustomAction.prototype.execute = function (lexer) {
  28331. // assume the input stream position was properly set by the calling code
  28332. this.action.execute(lexer);
  28333. };
  28334. LexerIndexedCustomAction.prototype.updateHashCode = function (hash) {
  28335. hash.update(this.actionType, this.offset, this.action);
  28336. };
  28337. LexerIndexedCustomAction.prototype.equals = function (other) {
  28338. if (this === other) {
  28339. return true;
  28340. } else if (!(other instanceof LexerIndexedCustomAction)) {
  28341. return false;
  28342. } else {
  28343. return this.offset === other.offset && this.action === other.action;
  28344. }
  28345. };
  28346. exports.LexerActionType = LexerActionType;
  28347. exports.LexerSkipAction = LexerSkipAction;
  28348. exports.LexerChannelAction = LexerChannelAction;
  28349. exports.LexerCustomAction = LexerCustomAction;
  28350. exports.LexerIndexedCustomAction = LexerIndexedCustomAction;
  28351. exports.LexerMoreAction = LexerMoreAction;
  28352. exports.LexerTypeAction = LexerTypeAction;
  28353. exports.LexerPushModeAction = LexerPushModeAction;
  28354. exports.LexerPopModeAction = LexerPopModeAction;
  28355. exports.LexerModeAction = LexerModeAction;
  28356. /***/ }),
  28357. /***/ "./node_modules/antlr4/atn/LexerActionExecutor.js":
  28358. /*!********************************************************!*\
  28359. !*** ./node_modules/antlr4/atn/LexerActionExecutor.js ***!
  28360. \********************************************************/
  28361. /*! no static exports found */
  28362. /***/ (function(module, exports, __webpack_require__) {
  28363. "use strict";
  28364. //
  28365. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  28366. * Use of this file is governed by the BSD 3-clause license that
  28367. * can be found in the LICENSE.txt file in the project root.
  28368. */
  28369. ///
  28370. // Represents an executor for a sequence of lexer actions which traversed during
  28371. // the matching operation of a lexer rule (token).
  28372. //
  28373. // <p>The executor tracks position information for position-dependent lexer actions
  28374. // efficiently, ensuring that actions appearing only at the end of the rule do
  28375. // not cause bloating of the {@link DFA} created for the lexer.</p>
  28376. var hashStuff = __webpack_require__(/*! ../Utils */ "./node_modules/antlr4/Utils.js").hashStuff;
  28377. var LexerIndexedCustomAction = __webpack_require__(/*! ./LexerAction */ "./node_modules/antlr4/atn/LexerAction.js").LexerIndexedCustomAction;
  28378. function LexerActionExecutor(lexerActions) {
  28379. this.lexerActions = lexerActions === null ? [] : lexerActions;
  28380. // Caches the result of {@link //hashCode} since the hash code is an element
  28381. // of the performance-critical {@link LexerATNConfig//hashCode} operation.
  28382. this.cachedHashCode = hashStuff(lexerActions); // "".join([str(la) for la in
  28383. // lexerActions]))
  28384. return this;
  28385. }
  28386. // Creates a {@link LexerActionExecutor} which executes the actions for
  28387. // the input {@code lexerActionExecutor} followed by a specified
  28388. // {@code lexerAction}.
  28389. //
  28390. // @param lexerActionExecutor The executor for actions already traversed by
  28391. // the lexer while matching a token within a particular
  28392. // {@link LexerATNConfig}. If this is {@code null}, the method behaves as
  28393. // though it were an empty executor.
  28394. // @param lexerAction The lexer action to execute after the actions
  28395. // specified in {@code lexerActionExecutor}.
  28396. //
  28397. // @return A {@link LexerActionExecutor} for executing the combine actions
  28398. // of {@code lexerActionExecutor} and {@code lexerAction}.
  28399. LexerActionExecutor.append = function (lexerActionExecutor, lexerAction) {
  28400. if (lexerActionExecutor === null) {
  28401. return new LexerActionExecutor([lexerAction]);
  28402. }
  28403. var lexerActions = lexerActionExecutor.lexerActions.concat([lexerAction]);
  28404. return new LexerActionExecutor(lexerActions);
  28405. };
  28406. // Creates a {@link LexerActionExecutor} which encodes the current offset
  28407. // for position-dependent lexer actions.
  28408. //
  28409. // <p>Normally, when the executor encounters lexer actions where
  28410. // {@link LexerAction//isPositionDependent} returns {@code true}, it calls
  28411. // {@link IntStream//seek} on the input {@link CharStream} to set the input
  28412. // position to the <em>end</em> of the current token. This behavior provides
  28413. // for efficient DFA representation of lexer actions which appear at the end
  28414. // of a lexer rule, even when the lexer rule matches a variable number of
  28415. // characters.</p>
  28416. //
  28417. // <p>Prior to traversing a match transition in the ATN, the current offset
  28418. // from the token start index is assigned to all position-dependent lexer
  28419. // actions which have not already been assigned a fixed offset. By storing
  28420. // the offsets relative to the token start index, the DFA representation of
  28421. // lexer actions which appear in the middle of tokens remains efficient due
  28422. // to sharing among tokens of the same length, regardless of their absolute
  28423. // position in the input stream.</p>
  28424. //
  28425. // <p>If the current executor already has offsets assigned to all
  28426. // position-dependent lexer actions, the method returns {@code this}.</p>
  28427. //
  28428. // @param offset The current offset to assign to all position-dependent
  28429. // lexer actions which do not already have offsets assigned.
  28430. //
  28431. // @return A {@link LexerActionExecutor} which stores input stream offsets
  28432. // for all position-dependent lexer actions.
  28433. // /
  28434. LexerActionExecutor.prototype.fixOffsetBeforeMatch = function (offset) {
  28435. var updatedLexerActions = null;
  28436. for (var i = 0; i < this.lexerActions.length; i++) {
  28437. if (this.lexerActions[i].isPositionDependent && !(this.lexerActions[i] instanceof LexerIndexedCustomAction)) {
  28438. if (updatedLexerActions === null) {
  28439. updatedLexerActions = this.lexerActions.concat([]);
  28440. }
  28441. updatedLexerActions[i] = new LexerIndexedCustomAction(offset, this.lexerActions[i]);
  28442. }
  28443. }
  28444. if (updatedLexerActions === null) {
  28445. return this;
  28446. } else {
  28447. return new LexerActionExecutor(updatedLexerActions);
  28448. }
  28449. };
  28450. // Execute the actions encapsulated by this executor within the context of a
  28451. // particular {@link Lexer}.
  28452. //
  28453. // <p>This method calls {@link IntStream//seek} to set the position of the
  28454. // {@code input} {@link CharStream} prior to calling
  28455. // {@link LexerAction//execute} on a position-dependent action. Before the
  28456. // method returns, the input position will be restored to the same position
  28457. // it was in when the method was invoked.</p>
  28458. //
  28459. // @param lexer The lexer instance.
  28460. // @param input The input stream which is the source for the current token.
  28461. // When this method is called, the current {@link IntStream//index} for
  28462. // {@code input} should be the start of the following token, i.e. 1
  28463. // character past the end of the current token.
  28464. // @param startIndex The token start index. This value may be passed to
  28465. // {@link IntStream//seek} to set the {@code input} position to the beginning
  28466. // of the token.
  28467. // /
  28468. LexerActionExecutor.prototype.execute = function (lexer, input, startIndex) {
  28469. var requiresSeek = false;
  28470. var stopIndex = input.index;
  28471. try {
  28472. for (var i = 0; i < this.lexerActions.length; i++) {
  28473. var lexerAction = this.lexerActions[i];
  28474. if (lexerAction instanceof LexerIndexedCustomAction) {
  28475. var offset = lexerAction.offset;
  28476. input.seek(startIndex + offset);
  28477. lexerAction = lexerAction.action;
  28478. requiresSeek = startIndex + offset !== stopIndex;
  28479. } else if (lexerAction.isPositionDependent) {
  28480. input.seek(stopIndex);
  28481. requiresSeek = false;
  28482. }
  28483. lexerAction.execute(lexer);
  28484. }
  28485. } finally {
  28486. if (requiresSeek) {
  28487. input.seek(stopIndex);
  28488. }
  28489. }
  28490. };
  28491. LexerActionExecutor.prototype.hashCode = function () {
  28492. return this.cachedHashCode;
  28493. };
  28494. LexerActionExecutor.prototype.updateHashCode = function (hash) {
  28495. hash.update(this.cachedHashCode);
  28496. };
  28497. LexerActionExecutor.prototype.equals = function (other) {
  28498. if (this === other) {
  28499. return true;
  28500. } else if (!(other instanceof LexerActionExecutor)) {
  28501. return false;
  28502. } else if (this.cachedHashCode != other.cachedHashCode) {
  28503. return false;
  28504. } else if (this.lexerActions.length != other.lexerActions.length) {
  28505. return false;
  28506. } else {
  28507. var numActions = this.lexerActions.length;
  28508. for (var idx = 0; idx < numActions; ++idx) {
  28509. if (!this.lexerActions[idx].equals(other.lexerActions[idx])) {
  28510. return false;
  28511. }
  28512. }
  28513. return true;
  28514. }
  28515. };
  28516. exports.LexerActionExecutor = LexerActionExecutor;
  28517. /***/ }),
  28518. /***/ "./node_modules/antlr4/atn/ParserATNSimulator.js":
  28519. /*!*******************************************************!*\
  28520. !*** ./node_modules/antlr4/atn/ParserATNSimulator.js ***!
  28521. \*******************************************************/
  28522. /*! no static exports found */
  28523. /***/ (function(module, exports, __webpack_require__) {
  28524. "use strict";
  28525. //
  28526. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  28527. * Use of this file is governed by the BSD 3-clause license that
  28528. * can be found in the LICENSE.txt file in the project root.
  28529. */
  28530. //
  28531. //
  28532. // The embodiment of the adaptive LL(*), ALL(*), parsing strategy.
  28533. //
  28534. // <p>
  28535. // The basic complexity of the adaptive strategy makes it harder to understand.
  28536. // We begin with ATN simulation to build paths in a DFA. Subsequent prediction
  28537. // requests go through the DFA first. If they reach a state without an edge for
  28538. // the current symbol, the algorithm fails over to the ATN simulation to
  28539. // complete the DFA path for the current input (until it finds a conflict state
  28540. // or uniquely predicting state).</p>
  28541. //
  28542. // <p>
  28543. // All of that is done without using the outer context because we want to create
  28544. // a DFA that is not dependent upon the rule invocation stack when we do a
  28545. // prediction. One DFA works in all contexts. We avoid using context not
  28546. // necessarily because it's slower, although it can be, but because of the DFA
  28547. // caching problem. The closure routine only considers the rule invocation stack
  28548. // created during prediction beginning in the decision rule. For example, if
  28549. // prediction occurs without invoking another rule's ATN, there are no context
  28550. // stacks in the configurations. When lack of context leads to a conflict, we
  28551. // don't know if it's an ambiguity or a weakness in the strong LL(*) parsing
  28552. // strategy (versus full LL(*)).</p>
  28553. //
  28554. // <p>
  28555. // When SLL yields a configuration set with conflict, we rewind the input and
  28556. // retry the ATN simulation, this time using full outer context without adding
  28557. // to the DFA. Configuration context stacks will be the full invocation stacks
  28558. // from the start rule. If we get a conflict using full context, then we can
  28559. // definitively say we have a true ambiguity for that input sequence. If we
  28560. // don't get a conflict, it implies that the decision is sensitive to the outer
  28561. // context. (It is not context-sensitive in the sense of context-sensitive
  28562. // grammars.)</p>
  28563. //
  28564. // <p>
  28565. // The next time we reach this DFA state with an SLL conflict, through DFA
  28566. // simulation, we will again retry the ATN simulation using full context mode.
  28567. // This is slow because we can't save the results and have to "interpret" the
  28568. // ATN each time we get that input.</p>
  28569. //
  28570. // <p>
  28571. // <strong>CACHING FULL CONTEXT PREDICTIONS</strong></p>
  28572. //
  28573. // <p>
  28574. // We could cache results from full context to predicted alternative easily and
  28575. // that saves a lot of time but doesn't work in presence of predicates. The set
  28576. // of visible predicates from the ATN start state changes depending on the
  28577. // context, because closure can fall off the end of a rule. I tried to cache
  28578. // tuples (stack context, semantic context, predicted alt) but it was slower
  28579. // than interpreting and much more complicated. Also required a huge amount of
  28580. // memory. The goal is not to create the world's fastest parser anyway. I'd like
  28581. // to keep this algorithm simple. By launching multiple threads, we can improve
  28582. // the speed of parsing across a large number of files.</p>
  28583. //
  28584. // <p>
  28585. // There is no strict ordering between the amount of input used by SLL vs LL,
  28586. // which makes it really hard to build a cache for full context. Let's say that
  28587. // we have input A B C that leads to an SLL conflict with full context X. That
  28588. // implies that using X we might only use A B but we could also use A B C D to
  28589. // resolve conflict. Input A B C D could predict alternative 1 in one position
  28590. // in the input and A B C E could predict alternative 2 in another position in
  28591. // input. The conflicting SLL configurations could still be non-unique in the
  28592. // full context prediction, which would lead us to requiring more input than the
  28593. // original A B C. To make a prediction cache work, we have to track the exact
  28594. // input used during the previous prediction. That amounts to a cache that maps
  28595. // X to a specific DFA for that context.</p>
  28596. //
  28597. // <p>
  28598. // Something should be done for left-recursive expression predictions. They are
  28599. // likely LL(1) + pred eval. Easier to do the whole SLL unless error and retry
  28600. // with full LL thing Sam does.</p>
  28601. //
  28602. // <p>
  28603. // <strong>AVOIDING FULL CONTEXT PREDICTION</strong></p>
  28604. //
  28605. // <p>
  28606. // We avoid doing full context retry when the outer context is empty, we did not
  28607. // dip into the outer context by falling off the end of the decision state rule,
  28608. // or when we force SLL mode.</p>
  28609. //
  28610. // <p>
  28611. // As an example of the not dip into outer context case, consider as super
  28612. // constructor calls versus function calls. One grammar might look like
  28613. // this:</p>
  28614. //
  28615. // <pre>
  28616. // ctorBody
  28617. // : '{' superCall? stat* '}'
  28618. // ;
  28619. // </pre>
  28620. //
  28621. // <p>
  28622. // Or, you might see something like</p>
  28623. //
  28624. // <pre>
  28625. // stat
  28626. // : superCall ';'
  28627. // | expression ';'
  28628. // | ...
  28629. // ;
  28630. // </pre>
  28631. //
  28632. // <p>
  28633. // In both cases I believe that no closure operations will dip into the outer
  28634. // context. In the first case ctorBody in the worst case will stop at the '}'.
  28635. // In the 2nd case it should stop at the ';'. Both cases should stay within the
  28636. // entry rule and not dip into the outer context.</p>
  28637. //
  28638. // <p>
  28639. // <strong>PREDICATES</strong></p>
  28640. //
  28641. // <p>
  28642. // Predicates are always evaluated if present in either SLL or LL both. SLL and
  28643. // LL simulation deals with predicates differently. SLL collects predicates as
  28644. // it performs closure operations like ANTLR v3 did. It delays predicate
  28645. // evaluation until it reaches and accept state. This allows us to cache the SLL
  28646. // ATN simulation whereas, if we had evaluated predicates on-the-fly during
  28647. // closure, the DFA state configuration sets would be different and we couldn't
  28648. // build up a suitable DFA.</p>
  28649. //
  28650. // <p>
  28651. // When building a DFA accept state during ATN simulation, we evaluate any
  28652. // predicates and return the sole semantically valid alternative. If there is
  28653. // more than 1 alternative, we report an ambiguity. If there are 0 alternatives,
  28654. // we throw an exception. Alternatives without predicates act like they have
  28655. // true predicates. The simple way to think about it is to strip away all
  28656. // alternatives with false predicates and choose the minimum alternative that
  28657. // remains.</p>
  28658. //
  28659. // <p>
  28660. // When we start in the DFA and reach an accept state that's predicated, we test
  28661. // those and return the minimum semantically viable alternative. If no
  28662. // alternatives are viable, we throw an exception.</p>
  28663. //
  28664. // <p>
  28665. // During full LL ATN simulation, closure always evaluates predicates and
  28666. // on-the-fly. This is crucial to reducing the configuration set size during
  28667. // closure. It hits a landmine when parsing with the Java grammar, for example,
  28668. // without this on-the-fly evaluation.</p>
  28669. //
  28670. // <p>
  28671. // <strong>SHARING DFA</strong></p>
  28672. //
  28673. // <p>
  28674. // All instances of the same parser share the same decision DFAs through a
  28675. // static field. Each instance gets its own ATN simulator but they share the
  28676. // same {@link //decisionToDFA} field. They also share a
  28677. // {@link PredictionContextCache} object that makes sure that all
  28678. // {@link PredictionContext} objects are shared among the DFA states. This makes
  28679. // a big size difference.</p>
  28680. //
  28681. // <p>
  28682. // <strong>THREAD SAFETY</strong></p>
  28683. //
  28684. // <p>
  28685. // The {@link ParserATNSimulator} locks on the {@link //decisionToDFA} field when
  28686. // it adds a new DFA object to that array. {@link //addDFAEdge}
  28687. // locks on the DFA for the current decision when setting the
  28688. // {@link DFAState//edges} field. {@link //addDFAState} locks on
  28689. // the DFA for the current decision when looking up a DFA state to see if it
  28690. // already exists. We must make sure that all requests to add DFA states that
  28691. // are equivalent result in the same shared DFA object. This is because lots of
  28692. // threads will be trying to update the DFA at once. The
  28693. // {@link //addDFAState} method also locks inside the DFA lock
  28694. // but this time on the shared context cache when it rebuilds the
  28695. // configurations' {@link PredictionContext} objects using cached
  28696. // subgraphs/nodes. No other locking occurs, even during DFA simulation. This is
  28697. // safe as long as we can guarantee that all threads referencing
  28698. // {@code s.edge[t]} get the same physical target {@link DFAState}, or
  28699. // {@code null}. Once into the DFA, the DFA simulation does not reference the
  28700. // {@link DFA//states} map. It follows the {@link DFAState//edges} field to new
  28701. // targets. The DFA simulator will either find {@link DFAState//edges} to be
  28702. // {@code null}, to be non-{@code null} and {@code dfa.edges[t]} null, or
  28703. // {@code dfa.edges[t]} to be non-null. The
  28704. // {@link //addDFAEdge} method could be racing to set the field
  28705. // but in either case the DFA simulator works; if {@code null}, and requests ATN
  28706. // simulation. It could also race trying to get {@code dfa.edges[t]}, but either
  28707. // way it will work because it's not doing a test and set operation.</p>
  28708. //
  28709. // <p>
  28710. // <strong>Starting with SLL then failing to combined SLL/LL (Two-Stage
  28711. // Parsing)</strong></p>
  28712. //
  28713. // <p>
  28714. // Sam pointed out that if SLL does not give a syntax error, then there is no
  28715. // point in doing full LL, which is slower. We only have to try LL if we get a
  28716. // syntax error. For maximum speed, Sam starts the parser set to pure SLL
  28717. // mode with the {@link BailErrorStrategy}:</p>
  28718. //
  28719. // <pre>
  28720. // parser.{@link Parser//getInterpreter() getInterpreter()}.{@link //setPredictionMode setPredictionMode}{@code (}{@link PredictionMode//SLL}{@code )};
  28721. // parser.{@link Parser//setErrorHandler setErrorHandler}(new {@link BailErrorStrategy}());
  28722. // </pre>
  28723. //
  28724. // <p>
  28725. // If it does not get a syntax error, then we're done. If it does get a syntax
  28726. // error, we need to retry with the combined SLL/LL strategy.</p>
  28727. //
  28728. // <p>
  28729. // The reason this works is as follows. If there are no SLL conflicts, then the
  28730. // grammar is SLL (at least for that input set). If there is an SLL conflict,
  28731. // the full LL analysis must yield a set of viable alternatives which is a
  28732. // subset of the alternatives reported by SLL. If the LL set is a singleton,
  28733. // then the grammar is LL but not SLL. If the LL set is the same size as the SLL
  28734. // set, the decision is SLL. If the LL set has size &gt; 1, then that decision
  28735. // is truly ambiguous on the current input. If the LL set is smaller, then the
  28736. // SLL conflict resolution might choose an alternative that the full LL would
  28737. // rule out as a possibility based upon better context information. If that's
  28738. // the case, then the SLL parse will definitely get an error because the full LL
  28739. // analysis says it's not viable. If SLL conflict resolution chooses an
  28740. // alternative within the LL set, them both SLL and LL would choose the same
  28741. // alternative because they both choose the minimum of multiple conflicting
  28742. // alternatives.</p>
  28743. //
  28744. // <p>
  28745. // Let's say we have a set of SLL conflicting alternatives {@code {1, 2, 3}} and
  28746. // a smaller LL set called <em>s</em>. If <em>s</em> is {@code {2, 3}}, then SLL
  28747. // parsing will get an error because SLL will pursue alternative 1. If
  28748. // <em>s</em> is {@code {1, 2}} or {@code {1, 3}} then both SLL and LL will
  28749. // choose the same alternative because alternative one is the minimum of either
  28750. // set. If <em>s</em> is {@code {2}} or {@code {3}} then SLL will get a syntax
  28751. // error. If <em>s</em> is {@code {1}} then SLL will succeed.</p>
  28752. //
  28753. // <p>
  28754. // Of course, if the input is invalid, then we will get an error for sure in
  28755. // both SLL and LL parsing. Erroneous input will therefore require 2 passes over
  28756. // the input.</p>
  28757. //
  28758. var Utils = __webpack_require__(/*! ./../Utils */ "./node_modules/antlr4/Utils.js");
  28759. var Set = Utils.Set;
  28760. var BitSet = Utils.BitSet;
  28761. var DoubleDict = Utils.DoubleDict;
  28762. var ATN = __webpack_require__(/*! ./ATN */ "./node_modules/antlr4/atn/ATN.js").ATN;
  28763. var ATNState = __webpack_require__(/*! ./ATNState */ "./node_modules/antlr4/atn/ATNState.js").ATNState;
  28764. var ATNConfig = __webpack_require__(/*! ./ATNConfig */ "./node_modules/antlr4/atn/ATNConfig.js").ATNConfig;
  28765. var ATNConfigSet = __webpack_require__(/*! ./ATNConfigSet */ "./node_modules/antlr4/atn/ATNConfigSet.js").ATNConfigSet;
  28766. var Token = __webpack_require__(/*! ./../Token */ "./node_modules/antlr4/Token.js").Token;
  28767. var DFAState = __webpack_require__(/*! ./../dfa/DFAState */ "./node_modules/antlr4/dfa/DFAState.js").DFAState;
  28768. var PredPrediction = __webpack_require__(/*! ./../dfa/DFAState */ "./node_modules/antlr4/dfa/DFAState.js").PredPrediction;
  28769. var ATNSimulator = __webpack_require__(/*! ./ATNSimulator */ "./node_modules/antlr4/atn/ATNSimulator.js").ATNSimulator;
  28770. var PredictionMode = __webpack_require__(/*! ./PredictionMode */ "./node_modules/antlr4/atn/PredictionMode.js").PredictionMode;
  28771. var RuleContext = __webpack_require__(/*! ./../RuleContext */ "./node_modules/antlr4/RuleContext.js").RuleContext;
  28772. var ParserRuleContext = __webpack_require__(/*! ./../ParserRuleContext */ "./node_modules/antlr4/ParserRuleContext.js").ParserRuleContext;
  28773. var SemanticContext = __webpack_require__(/*! ./SemanticContext */ "./node_modules/antlr4/atn/SemanticContext.js").SemanticContext;
  28774. var StarLoopEntryState = __webpack_require__(/*! ./ATNState */ "./node_modules/antlr4/atn/ATNState.js").StarLoopEntryState;
  28775. var RuleStopState = __webpack_require__(/*! ./ATNState */ "./node_modules/antlr4/atn/ATNState.js").RuleStopState;
  28776. var PredictionContext = __webpack_require__(/*! ./../PredictionContext */ "./node_modules/antlr4/PredictionContext.js").PredictionContext;
  28777. var Interval = __webpack_require__(/*! ./../IntervalSet */ "./node_modules/antlr4/IntervalSet.js").Interval;
  28778. var Transitions = __webpack_require__(/*! ./Transition */ "./node_modules/antlr4/atn/Transition.js");
  28779. var Transition = Transitions.Transition;
  28780. var SetTransition = Transitions.SetTransition;
  28781. var NotSetTransition = Transitions.NotSetTransition;
  28782. var RuleTransition = Transitions.RuleTransition;
  28783. var ActionTransition = Transitions.ActionTransition;
  28784. var NoViableAltException = __webpack_require__(/*! ./../error/Errors */ "./node_modules/antlr4/error/Errors.js").NoViableAltException;
  28785. var SingletonPredictionContext = __webpack_require__(/*! ./../PredictionContext */ "./node_modules/antlr4/PredictionContext.js").SingletonPredictionContext;
  28786. var predictionContextFromRuleContext = __webpack_require__(/*! ./../PredictionContext */ "./node_modules/antlr4/PredictionContext.js").predictionContextFromRuleContext;
  28787. function ParserATNSimulator(parser, atn, decisionToDFA, sharedContextCache) {
  28788. ATNSimulator.call(this, atn, sharedContextCache);
  28789. this.parser = parser;
  28790. this.decisionToDFA = decisionToDFA;
  28791. // SLL, LL, or LL + exact ambig detection?//
  28792. this.predictionMode = PredictionMode.LL;
  28793. // LAME globals to avoid parameters!!!!! I need these down deep in predTransition
  28794. this._input = null;
  28795. this._startIndex = 0;
  28796. this._outerContext = null;
  28797. this._dfa = null;
  28798. // Each prediction operation uses a cache for merge of prediction contexts.
  28799. // Don't keep around as it wastes huge amounts of memory. DoubleKeyMap
  28800. // isn't synchronized but we're ok since two threads shouldn't reuse same
  28801. // parser/atnsim object because it can only handle one input at a time.
  28802. // This maps graphs a and b to merged result c. (a,b)&rarr;c. We can avoid
  28803. // the merge if we ever see a and b again. Note that (b,a)&rarr;c should
  28804. // also be examined during cache lookup.
  28805. //
  28806. this.mergeCache = null;
  28807. return this;
  28808. }
  28809. ParserATNSimulator.prototype = Object.create(ATNSimulator.prototype);
  28810. ParserATNSimulator.prototype.constructor = ParserATNSimulator;
  28811. ParserATNSimulator.prototype.debug = false;
  28812. ParserATNSimulator.prototype.debug_closure = false;
  28813. ParserATNSimulator.prototype.debug_add = false;
  28814. ParserATNSimulator.prototype.debug_list_atn_decisions = false;
  28815. ParserATNSimulator.prototype.dfa_debug = false;
  28816. ParserATNSimulator.prototype.retry_debug = false;
  28817. ParserATNSimulator.prototype.reset = function () {};
  28818. ParserATNSimulator.prototype.adaptivePredict = function (input, decision, outerContext) {
  28819. if (this.debug || this.debug_list_atn_decisions) {
  28820. console.log("adaptivePredict decision " + decision + " exec LA(1)==" + this.getLookaheadName(input) + " line " + input.LT(1).line + ":" + input.LT(1).column);
  28821. }
  28822. this._input = input;
  28823. this._startIndex = input.index;
  28824. this._outerContext = outerContext;
  28825. var dfa = this.decisionToDFA[decision];
  28826. this._dfa = dfa;
  28827. var m = input.mark();
  28828. var index = input.index;
  28829. // Now we are certain to have a specific decision's DFA
  28830. // But, do we still need an initial state?
  28831. try {
  28832. var s0;
  28833. if (dfa.precedenceDfa) {
  28834. // the start state for a precedence DFA depends on the current
  28835. // parser precedence, and is provided by a DFA method.
  28836. s0 = dfa.getPrecedenceStartState(this.parser.getPrecedence());
  28837. } else {
  28838. // the start state for a "regular" DFA is just s0
  28839. s0 = dfa.s0;
  28840. }
  28841. if (s0 === null) {
  28842. if (outerContext === null) {
  28843. outerContext = RuleContext.EMPTY;
  28844. }
  28845. if (this.debug || this.debug_list_atn_decisions) {
  28846. console.log("predictATN decision " + dfa.decision + " exec LA(1)==" + this.getLookaheadName(input) + ", outerContext=" + outerContext.toString(this.parser.ruleNames));
  28847. }
  28848. var fullCtx = false;
  28849. var s0_closure = this.computeStartState(dfa.atnStartState, RuleContext.EMPTY, fullCtx);
  28850. if (dfa.precedenceDfa) {
  28851. // If this is a precedence DFA, we use applyPrecedenceFilter
  28852. // to convert the computed start state to a precedence start
  28853. // state. We then use DFA.setPrecedenceStartState to set the
  28854. // appropriate start state for the precedence level rather
  28855. // than simply setting DFA.s0.
  28856. //
  28857. dfa.s0.configs = s0_closure; // not used for prediction but useful to know start configs anyway
  28858. s0_closure = this.applyPrecedenceFilter(s0_closure);
  28859. s0 = this.addDFAState(dfa, new DFAState(null, s0_closure));
  28860. dfa.setPrecedenceStartState(this.parser.getPrecedence(), s0);
  28861. } else {
  28862. s0 = this.addDFAState(dfa, new DFAState(null, s0_closure));
  28863. dfa.s0 = s0;
  28864. }
  28865. }
  28866. var alt = this.execATN(dfa, s0, input, index, outerContext);
  28867. if (this.debug) {
  28868. console.log("DFA after predictATN: " + dfa.toString(this.parser.literalNames));
  28869. }
  28870. return alt;
  28871. } finally {
  28872. this._dfa = null;
  28873. this.mergeCache = null; // wack cache after each prediction
  28874. input.seek(index);
  28875. input.release(m);
  28876. }
  28877. };
  28878. // Performs ATN simulation to compute a predicted alternative based
  28879. // upon the remaining input, but also updates the DFA cache to avoid
  28880. // having to traverse the ATN again for the same input sequence.
  28881. // There are some key conditions we're looking for after computing a new
  28882. // set of ATN configs (proposed DFA state):
  28883. // if the set is empty, there is no viable alternative for current symbol
  28884. // does the state uniquely predict an alternative?
  28885. // does the state have a conflict that would prevent us from
  28886. // putting it on the work list?
  28887. // We also have some key operations to do:
  28888. // add an edge from previous DFA state to potentially new DFA state, D,
  28889. // upon current symbol but only if adding to work list, which means in all
  28890. // cases except no viable alternative (and possibly non-greedy decisions?)
  28891. // collecting predicates and adding semantic context to DFA accept states
  28892. // adding rule context to context-sensitive DFA accept states
  28893. // consuming an input symbol
  28894. // reporting a conflict
  28895. // reporting an ambiguity
  28896. // reporting a context sensitivity
  28897. // reporting insufficient predicates
  28898. // cover these cases:
  28899. // dead end
  28900. // single alt
  28901. // single alt + preds
  28902. // conflict
  28903. // conflict + preds
  28904. //
  28905. ParserATNSimulator.prototype.execATN = function (dfa, s0, input, startIndex, outerContext) {
  28906. if (this.debug || this.debug_list_atn_decisions) {
  28907. console.log("execATN decision " + dfa.decision + " exec LA(1)==" + this.getLookaheadName(input) + " line " + input.LT(1).line + ":" + input.LT(1).column);
  28908. }
  28909. var alt;
  28910. var previousD = s0;
  28911. if (this.debug) {
  28912. console.log("s0 = " + s0);
  28913. }
  28914. var t = input.LA(1);
  28915. while (true) {
  28916. // while more work
  28917. var D = this.getExistingTargetState(previousD, t);
  28918. if (D === null) {
  28919. D = this.computeTargetState(dfa, previousD, t);
  28920. }
  28921. if (D === ATNSimulator.ERROR) {
  28922. // if any configs in previous dipped into outer context, that
  28923. // means that input up to t actually finished entry rule
  28924. // at least for SLL decision. Full LL doesn't dip into outer
  28925. // so don't need special case.
  28926. // We will get an error no matter what so delay until after
  28927. // decision; better error message. Also, no reachable target
  28928. // ATN states in SLL implies LL will also get nowhere.
  28929. // If conflict in states that dip out, choose min since we
  28930. // will get error no matter what.
  28931. var e = this.noViableAlt(input, outerContext, previousD.configs, startIndex);
  28932. input.seek(startIndex);
  28933. alt = this.getSynValidOrSemInvalidAltThatFinishedDecisionEntryRule(previousD.configs, outerContext);
  28934. if (alt !== ATN.INVALID_ALT_NUMBER) {
  28935. return alt;
  28936. } else {
  28937. throw e;
  28938. }
  28939. }
  28940. if (D.requiresFullContext && this.predictionMode !== PredictionMode.SLL) {
  28941. // IF PREDS, MIGHT RESOLVE TO SINGLE ALT => SLL (or syntax error)
  28942. var conflictingAlts = null;
  28943. if (D.predicates !== null) {
  28944. if (this.debug) {
  28945. console.log("DFA state has preds in DFA sim LL failover");
  28946. }
  28947. var conflictIndex = input.index;
  28948. if (conflictIndex !== startIndex) {
  28949. input.seek(startIndex);
  28950. }
  28951. conflictingAlts = this.evalSemanticContext(D.predicates, outerContext, true);
  28952. if (conflictingAlts.length === 1) {
  28953. if (this.debug) {
  28954. console.log("Full LL avoided");
  28955. }
  28956. return conflictingAlts.minValue();
  28957. }
  28958. if (conflictIndex !== startIndex) {
  28959. // restore the index so reporting the fallback to full
  28960. // context occurs with the index at the correct spot
  28961. input.seek(conflictIndex);
  28962. }
  28963. }
  28964. if (this.dfa_debug) {
  28965. console.log("ctx sensitive state " + outerContext + " in " + D);
  28966. }
  28967. var fullCtx = true;
  28968. var s0_closure = this.computeStartState(dfa.atnStartState, outerContext, fullCtx);
  28969. this.reportAttemptingFullContext(dfa, conflictingAlts, D.configs, startIndex, input.index);
  28970. alt = this.execATNWithFullContext(dfa, D, s0_closure, input, startIndex, outerContext);
  28971. return alt;
  28972. }
  28973. if (D.isAcceptState) {
  28974. if (D.predicates === null) {
  28975. return D.prediction;
  28976. }
  28977. var stopIndex = input.index;
  28978. input.seek(startIndex);
  28979. var alts = this.evalSemanticContext(D.predicates, outerContext, true);
  28980. if (alts.length === 0) {
  28981. throw this.noViableAlt(input, outerContext, D.configs, startIndex);
  28982. } else if (alts.length === 1) {
  28983. return alts.minValue();
  28984. } else {
  28985. // report ambiguity after predicate evaluation to make sure the correct set of ambig alts is reported.
  28986. this.reportAmbiguity(dfa, D, startIndex, stopIndex, false, alts, D.configs);
  28987. return alts.minValue();
  28988. }
  28989. }
  28990. previousD = D;
  28991. if (t !== Token.EOF) {
  28992. input.consume();
  28993. t = input.LA(1);
  28994. }
  28995. }
  28996. };
  28997. //
  28998. // Get an existing target state for an edge in the DFA. If the target state
  28999. // for the edge has not yet been computed or is otherwise not available,
  29000. // this method returns {@code null}.
  29001. //
  29002. // @param previousD The current DFA state
  29003. // @param t The next input symbol
  29004. // @return The existing target DFA state for the given input symbol
  29005. // {@code t}, or {@code null} if the target state for this edge is not
  29006. // already cached
  29007. //
  29008. ParserATNSimulator.prototype.getExistingTargetState = function (previousD, t) {
  29009. var edges = previousD.edges;
  29010. if (edges === null) {
  29011. return null;
  29012. } else {
  29013. return edges[t + 1] || null;
  29014. }
  29015. };
  29016. //
  29017. // Compute a target state for an edge in the DFA, and attempt to add the
  29018. // computed state and corresponding edge to the DFA.
  29019. //
  29020. // @param dfa The DFA
  29021. // @param previousD The current DFA state
  29022. // @param t The next input symbol
  29023. //
  29024. // @return The computed target DFA state for the given input symbol
  29025. // {@code t}. If {@code t} does not lead to a valid DFA state, this method
  29026. // returns {@link //ERROR}.
  29027. //
  29028. ParserATNSimulator.prototype.computeTargetState = function (dfa, previousD, t) {
  29029. var reach = this.computeReachSet(previousD.configs, t, false);
  29030. if (reach === null) {
  29031. this.addDFAEdge(dfa, previousD, t, ATNSimulator.ERROR);
  29032. return ATNSimulator.ERROR;
  29033. }
  29034. // create new target state; we'll add to DFA after it's complete
  29035. var D = new DFAState(null, reach);
  29036. var predictedAlt = this.getUniqueAlt(reach);
  29037. if (this.debug) {
  29038. var altSubSets = PredictionMode.getConflictingAltSubsets(reach);
  29039. console.log("SLL altSubSets=" + Utils.arrayToString(altSubSets) + ", previous=" + previousD.configs + ", configs=" + reach + ", predict=" + predictedAlt + ", allSubsetsConflict=" + PredictionMode.allSubsetsConflict(altSubSets) + ", conflictingAlts=" + this.getConflictingAlts(reach));
  29040. }
  29041. if (predictedAlt !== ATN.INVALID_ALT_NUMBER) {
  29042. // NO CONFLICT, UNIQUELY PREDICTED ALT
  29043. D.isAcceptState = true;
  29044. D.configs.uniqueAlt = predictedAlt;
  29045. D.prediction = predictedAlt;
  29046. } else if (PredictionMode.hasSLLConflictTerminatingPrediction(this.predictionMode, reach)) {
  29047. // MORE THAN ONE VIABLE ALTERNATIVE
  29048. D.configs.conflictingAlts = this.getConflictingAlts(reach);
  29049. D.requiresFullContext = true;
  29050. // in SLL-only mode, we will stop at this state and return the minimum alt
  29051. D.isAcceptState = true;
  29052. D.prediction = D.configs.conflictingAlts.minValue();
  29053. }
  29054. if (D.isAcceptState && D.configs.hasSemanticContext) {
  29055. this.predicateDFAState(D, this.atn.getDecisionState(dfa.decision));
  29056. if (D.predicates !== null) {
  29057. D.prediction = ATN.INVALID_ALT_NUMBER;
  29058. }
  29059. }
  29060. // all adds to dfa are done after we've created full D state
  29061. D = this.addDFAEdge(dfa, previousD, t, D);
  29062. return D;
  29063. };
  29064. ParserATNSimulator.prototype.predicateDFAState = function (dfaState, decisionState) {
  29065. // We need to test all predicates, even in DFA states that
  29066. // uniquely predict alternative.
  29067. var nalts = decisionState.transitions.length;
  29068. // Update DFA so reach becomes accept state with (predicate,alt)
  29069. // pairs if preds found for conflicting alts
  29070. var altsToCollectPredsFrom = this.getConflictingAltsOrUniqueAlt(dfaState.configs);
  29071. var altToPred = this.getPredsForAmbigAlts(altsToCollectPredsFrom, dfaState.configs, nalts);
  29072. if (altToPred !== null) {
  29073. dfaState.predicates = this.getPredicatePredictions(altsToCollectPredsFrom, altToPred);
  29074. dfaState.prediction = ATN.INVALID_ALT_NUMBER; // make sure we use preds
  29075. } else {
  29076. // There are preds in configs but they might go away
  29077. // when OR'd together like {p}? || NONE == NONE. If neither
  29078. // alt has preds, resolve to min alt
  29079. dfaState.prediction = altsToCollectPredsFrom.minValue();
  29080. }
  29081. };
  29082. // comes back with reach.uniqueAlt set to a valid alt
  29083. ParserATNSimulator.prototype.execATNWithFullContext = function (dfa, D, // how far we got before failing over
  29084. s0, input, startIndex, outerContext) {
  29085. if (this.debug || this.debug_list_atn_decisions) {
  29086. console.log("execATNWithFullContext " + s0);
  29087. }
  29088. var fullCtx = true;
  29089. var foundExactAmbig = false;
  29090. var reach = null;
  29091. var previous = s0;
  29092. input.seek(startIndex);
  29093. var t = input.LA(1);
  29094. var predictedAlt = -1;
  29095. while (true) {
  29096. // while more work
  29097. reach = this.computeReachSet(previous, t, fullCtx);
  29098. if (reach === null) {
  29099. // if any configs in previous dipped into outer context, that
  29100. // means that input up to t actually finished entry rule
  29101. // at least for LL decision. Full LL doesn't dip into outer
  29102. // so don't need special case.
  29103. // We will get an error no matter what so delay until after
  29104. // decision; better error message. Also, no reachable target
  29105. // ATN states in SLL implies LL will also get nowhere.
  29106. // If conflict in states that dip out, choose min since we
  29107. // will get error no matter what.
  29108. var e = this.noViableAlt(input, outerContext, previous, startIndex);
  29109. input.seek(startIndex);
  29110. var alt = this.getSynValidOrSemInvalidAltThatFinishedDecisionEntryRule(previous, outerContext);
  29111. if (alt !== ATN.INVALID_ALT_NUMBER) {
  29112. return alt;
  29113. } else {
  29114. throw e;
  29115. }
  29116. }
  29117. var altSubSets = PredictionMode.getConflictingAltSubsets(reach);
  29118. if (this.debug) {
  29119. console.log("LL altSubSets=" + altSubSets + ", predict=" + PredictionMode.getUniqueAlt(altSubSets) + ", resolvesToJustOneViableAlt=" + PredictionMode.resolvesToJustOneViableAlt(altSubSets));
  29120. }
  29121. reach.uniqueAlt = this.getUniqueAlt(reach);
  29122. // unique prediction?
  29123. if (reach.uniqueAlt !== ATN.INVALID_ALT_NUMBER) {
  29124. predictedAlt = reach.uniqueAlt;
  29125. break;
  29126. } else if (this.predictionMode !== PredictionMode.LL_EXACT_AMBIG_DETECTION) {
  29127. predictedAlt = PredictionMode.resolvesToJustOneViableAlt(altSubSets);
  29128. if (predictedAlt !== ATN.INVALID_ALT_NUMBER) {
  29129. break;
  29130. }
  29131. } else {
  29132. // In exact ambiguity mode, we never try to terminate early.
  29133. // Just keeps scarfing until we know what the conflict is
  29134. if (PredictionMode.allSubsetsConflict(altSubSets) && PredictionMode.allSubsetsEqual(altSubSets)) {
  29135. foundExactAmbig = true;
  29136. predictedAlt = PredictionMode.getSingleViableAlt(altSubSets);
  29137. break;
  29138. }
  29139. // else there are multiple non-conflicting subsets or
  29140. // we're not sure what the ambiguity is yet.
  29141. // So, keep going.
  29142. }
  29143. previous = reach;
  29144. if (t !== Token.EOF) {
  29145. input.consume();
  29146. t = input.LA(1);
  29147. }
  29148. }
  29149. // If the configuration set uniquely predicts an alternative,
  29150. // without conflict, then we know that it's a full LL decision
  29151. // not SLL.
  29152. if (reach.uniqueAlt !== ATN.INVALID_ALT_NUMBER) {
  29153. this.reportContextSensitivity(dfa, predictedAlt, reach, startIndex, input.index);
  29154. return predictedAlt;
  29155. }
  29156. // We do not check predicates here because we have checked them
  29157. // on-the-fly when doing full context prediction.
  29158. //
  29159. // In non-exact ambiguity detection mode, we might actually be able to
  29160. // detect an exact ambiguity, but I'm not going to spend the cycles
  29161. // needed to check. We only emit ambiguity warnings in exact ambiguity
  29162. // mode.
  29163. //
  29164. // For example, we might know that we have conflicting configurations.
  29165. // But, that does not mean that there is no way forward without a
  29166. // conflict. It's possible to have nonconflicting alt subsets as in:
  29167. // altSubSets=[{1, 2}, {1, 2}, {1}, {1, 2}]
  29168. // from
  29169. //
  29170. // [(17,1,[5 $]), (13,1,[5 10 $]), (21,1,[5 10 $]), (11,1,[$]),
  29171. // (13,2,[5 10 $]), (21,2,[5 10 $]), (11,2,[$])]
  29172. //
  29173. // In this case, (17,1,[5 $]) indicates there is some next sequence that
  29174. // would resolve this without conflict to alternative 1. Any other viable
  29175. // next sequence, however, is associated with a conflict. We stop
  29176. // looking for input because no amount of further lookahead will alter
  29177. // the fact that we should predict alternative 1. We just can't say for
  29178. // sure that there is an ambiguity without looking further.
  29179. this.reportAmbiguity(dfa, D, startIndex, input.index, foundExactAmbig, null, reach);
  29180. return predictedAlt;
  29181. };
  29182. ParserATNSimulator.prototype.computeReachSet = function (closure, t, fullCtx) {
  29183. if (this.debug) {
  29184. console.log("in computeReachSet, starting closure: " + closure);
  29185. }
  29186. if (this.mergeCache === null) {
  29187. this.mergeCache = new DoubleDict();
  29188. }
  29189. var intermediate = new ATNConfigSet(fullCtx);
  29190. // Configurations already in a rule stop state indicate reaching the end
  29191. // of the decision rule (local context) or end of the start rule (full
  29192. // context). Once reached, these configurations are never updated by a
  29193. // closure operation, so they are handled separately for the performance
  29194. // advantage of having a smaller intermediate set when calling closure.
  29195. //
  29196. // For full-context reach operations, separate handling is required to
  29197. // ensure that the alternative matching the longest overall sequence is
  29198. // chosen when multiple such configurations can match the input.
  29199. var skippedStopStates = null;
  29200. // First figure out where we can reach on input t
  29201. for (var i = 0; i < closure.items.length; i++) {
  29202. var c = closure.items[i];
  29203. if (this.debug_add) {
  29204. console.log("testing " + this.getTokenName(t) + " at " + c);
  29205. }
  29206. if (c.state instanceof RuleStopState) {
  29207. if (fullCtx || t === Token.EOF) {
  29208. if (skippedStopStates === null) {
  29209. skippedStopStates = [];
  29210. }
  29211. skippedStopStates.push(c);
  29212. if (this.debug_add) {
  29213. console.log("added " + c + " to skippedStopStates");
  29214. }
  29215. }
  29216. continue;
  29217. }
  29218. for (var j = 0; j < c.state.transitions.length; j++) {
  29219. var trans = c.state.transitions[j];
  29220. var target = this.getReachableTarget(trans, t);
  29221. if (target !== null) {
  29222. var cfg = new ATNConfig({ state: target }, c);
  29223. intermediate.add(cfg, this.mergeCache);
  29224. if (this.debug_add) {
  29225. console.log("added " + cfg + " to intermediate");
  29226. }
  29227. }
  29228. }
  29229. }
  29230. // Now figure out where the reach operation can take us...
  29231. var reach = null;
  29232. // This block optimizes the reach operation for intermediate sets which
  29233. // trivially indicate a termination state for the overall
  29234. // adaptivePredict operation.
  29235. //
  29236. // The conditions assume that intermediate
  29237. // contains all configurations relevant to the reach set, but this
  29238. // condition is not true when one or more configurations have been
  29239. // withheld in skippedStopStates, or when the current symbol is EOF.
  29240. //
  29241. if (skippedStopStates === null && t !== Token.EOF) {
  29242. if (intermediate.items.length === 1) {
  29243. // Don't pursue the closure if there is just one state.
  29244. // It can only have one alternative; just add to result
  29245. // Also don't pursue the closure if there is unique alternative
  29246. // among the configurations.
  29247. reach = intermediate;
  29248. } else if (this.getUniqueAlt(intermediate) !== ATN.INVALID_ALT_NUMBER) {
  29249. // Also don't pursue the closure if there is unique alternative
  29250. // among the configurations.
  29251. reach = intermediate;
  29252. }
  29253. }
  29254. // If the reach set could not be trivially determined, perform a closure
  29255. // operation on the intermediate set to compute its initial value.
  29256. //
  29257. if (reach === null) {
  29258. reach = new ATNConfigSet(fullCtx);
  29259. var closureBusy = new Set();
  29260. var treatEofAsEpsilon = t === Token.EOF;
  29261. for (var k = 0; k < intermediate.items.length; k++) {
  29262. this.closure(intermediate.items[k], reach, closureBusy, false, fullCtx, treatEofAsEpsilon);
  29263. }
  29264. }
  29265. if (t === Token.EOF) {
  29266. // After consuming EOF no additional input is possible, so we are
  29267. // only interested in configurations which reached the end of the
  29268. // decision rule (local context) or end of the start rule (full
  29269. // context). Update reach to contain only these configurations. This
  29270. // handles both explicit EOF transitions in the grammar and implicit
  29271. // EOF transitions following the end of the decision or start rule.
  29272. //
  29273. // When reach==intermediate, no closure operation was performed. In
  29274. // this case, removeAllConfigsNotInRuleStopState needs to check for
  29275. // reachable rule stop states as well as configurations already in
  29276. // a rule stop state.
  29277. //
  29278. // This is handled before the configurations in skippedStopStates,
  29279. // because any configurations potentially added from that list are
  29280. // already guaranteed to meet this condition whether or not it's
  29281. // required.
  29282. //
  29283. reach = this.removeAllConfigsNotInRuleStopState(reach, reach === intermediate);
  29284. }
  29285. // If skippedStopStates!==null, then it contains at least one
  29286. // configuration. For full-context reach operations, these
  29287. // configurations reached the end of the start rule, in which case we
  29288. // only add them back to reach if no configuration during the current
  29289. // closure operation reached such a state. This ensures adaptivePredict
  29290. // chooses an alternative matching the longest overall sequence when
  29291. // multiple alternatives are viable.
  29292. //
  29293. if (skippedStopStates !== null && (!fullCtx || !PredictionMode.hasConfigInRuleStopState(reach))) {
  29294. for (var l = 0; l < skippedStopStates.length; l++) {
  29295. reach.add(skippedStopStates[l], this.mergeCache);
  29296. }
  29297. }
  29298. if (reach.items.length === 0) {
  29299. return null;
  29300. } else {
  29301. return reach;
  29302. }
  29303. };
  29304. //
  29305. // Return a configuration set containing only the configurations from
  29306. // {@code configs} which are in a {@link RuleStopState}. If all
  29307. // configurations in {@code configs} are already in a rule stop state, this
  29308. // method simply returns {@code configs}.
  29309. //
  29310. // <p>When {@code lookToEndOfRule} is true, this method uses
  29311. // {@link ATN//nextTokens} for each configuration in {@code configs} which is
  29312. // not already in a rule stop state to see if a rule stop state is reachable
  29313. // from the configuration via epsilon-only transitions.</p>
  29314. //
  29315. // @param configs the configuration set to update
  29316. // @param lookToEndOfRule when true, this method checks for rule stop states
  29317. // reachable by epsilon-only transitions from each configuration in
  29318. // {@code configs}.
  29319. //
  29320. // @return {@code configs} if all configurations in {@code configs} are in a
  29321. // rule stop state, otherwise return a new configuration set containing only
  29322. // the configurations from {@code configs} which are in a rule stop state
  29323. //
  29324. ParserATNSimulator.prototype.removeAllConfigsNotInRuleStopState = function (configs, lookToEndOfRule) {
  29325. if (PredictionMode.allConfigsInRuleStopStates(configs)) {
  29326. return configs;
  29327. }
  29328. var result = new ATNConfigSet(configs.fullCtx);
  29329. for (var i = 0; i < configs.items.length; i++) {
  29330. var config = configs.items[i];
  29331. if (config.state instanceof RuleStopState) {
  29332. result.add(config, this.mergeCache);
  29333. continue;
  29334. }
  29335. if (lookToEndOfRule && config.state.epsilonOnlyTransitions) {
  29336. var nextTokens = this.atn.nextTokens(config.state);
  29337. if (nextTokens.contains(Token.EPSILON)) {
  29338. var endOfRuleState = this.atn.ruleToStopState[config.state.ruleIndex];
  29339. result.add(new ATNConfig({ state: endOfRuleState }, config), this.mergeCache);
  29340. }
  29341. }
  29342. }
  29343. return result;
  29344. };
  29345. ParserATNSimulator.prototype.computeStartState = function (p, ctx, fullCtx) {
  29346. // always at least the implicit call to start rule
  29347. var initialContext = predictionContextFromRuleContext(this.atn, ctx);
  29348. var configs = new ATNConfigSet(fullCtx);
  29349. for (var i = 0; i < p.transitions.length; i++) {
  29350. var target = p.transitions[i].target;
  29351. var c = new ATNConfig({ state: target, alt: i + 1, context: initialContext }, null);
  29352. var closureBusy = new Set();
  29353. this.closure(c, configs, closureBusy, true, fullCtx, false);
  29354. }
  29355. return configs;
  29356. };
  29357. //
  29358. // This method transforms the start state computed by
  29359. // {@link //computeStartState} to the special start state used by a
  29360. // precedence DFA for a particular precedence value. The transformation
  29361. // process applies the following changes to the start state's configuration
  29362. // set.
  29363. //
  29364. // <ol>
  29365. // <li>Evaluate the precedence predicates for each configuration using
  29366. // {@link SemanticContext//evalPrecedence}.</li>
  29367. // <li>Remove all configurations which predict an alternative greater than
  29368. // 1, for which another configuration that predicts alternative 1 is in the
  29369. // same ATN state with the same prediction context. This transformation is
  29370. // valid for the following reasons:
  29371. // <ul>
  29372. // <li>The closure block cannot contain any epsilon transitions which bypass
  29373. // the body of the closure, so all states reachable via alternative 1 are
  29374. // part of the precedence alternatives of the transformed left-recursive
  29375. // rule.</li>
  29376. // <li>The "primary" portion of a left recursive rule cannot contain an
  29377. // epsilon transition, so the only way an alternative other than 1 can exist
  29378. // in a state that is also reachable via alternative 1 is by nesting calls
  29379. // to the left-recursive rule, with the outer calls not being at the
  29380. // preferred precedence level.</li>
  29381. // </ul>
  29382. // </li>
  29383. // </ol>
  29384. //
  29385. // <p>
  29386. // The prediction context must be considered by this filter to address
  29387. // situations like the following.
  29388. // </p>
  29389. // <code>
  29390. // <pre>
  29391. // grammar TA;
  29392. // prog: statement* EOF;
  29393. // statement: letterA | statement letterA 'b' ;
  29394. // letterA: 'a';
  29395. // </pre>
  29396. // </code>
  29397. // <p>
  29398. // If the above grammar, the ATN state immediately before the token
  29399. // reference {@code 'a'} in {@code letterA} is reachable from the left edge
  29400. // of both the primary and closure blocks of the left-recursive rule
  29401. // {@code statement}. The prediction context associated with each of these
  29402. // configurations distinguishes between them, and prevents the alternative
  29403. // which stepped out to {@code prog} (and then back in to {@code statement}
  29404. // from being eliminated by the filter.
  29405. // </p>
  29406. //
  29407. // @param configs The configuration set computed by
  29408. // {@link //computeStartState} as the start state for the DFA.
  29409. // @return The transformed configuration set representing the start state
  29410. // for a precedence DFA at a particular precedence level (determined by
  29411. // calling {@link Parser//getPrecedence}).
  29412. //
  29413. ParserATNSimulator.prototype.applyPrecedenceFilter = function (configs) {
  29414. var config;
  29415. var statesFromAlt1 = [];
  29416. var configSet = new ATNConfigSet(configs.fullCtx);
  29417. for (var i = 0; i < configs.items.length; i++) {
  29418. config = configs.items[i];
  29419. // handle alt 1 first
  29420. if (config.alt !== 1) {
  29421. continue;
  29422. }
  29423. var updatedContext = config.semanticContext.evalPrecedence(this.parser, this._outerContext);
  29424. if (updatedContext === null) {
  29425. // the configuration was eliminated
  29426. continue;
  29427. }
  29428. statesFromAlt1[config.state.stateNumber] = config.context;
  29429. if (updatedContext !== config.semanticContext) {
  29430. configSet.add(new ATNConfig({ semanticContext: updatedContext }, config), this.mergeCache);
  29431. } else {
  29432. configSet.add(config, this.mergeCache);
  29433. }
  29434. }
  29435. for (i = 0; i < configs.items.length; i++) {
  29436. config = configs.items[i];
  29437. if (config.alt === 1) {
  29438. // already handled
  29439. continue;
  29440. }
  29441. // In the future, this elimination step could be updated to also
  29442. // filter the prediction context for alternatives predicting alt>1
  29443. // (basically a graph subtraction algorithm).
  29444. if (!config.precedenceFilterSuppressed) {
  29445. var context = statesFromAlt1[config.state.stateNumber] || null;
  29446. if (context !== null && context.equals(config.context)) {
  29447. // eliminated
  29448. continue;
  29449. }
  29450. }
  29451. configSet.add(config, this.mergeCache);
  29452. }
  29453. return configSet;
  29454. };
  29455. ParserATNSimulator.prototype.getReachableTarget = function (trans, ttype) {
  29456. if (trans.matches(ttype, 0, this.atn.maxTokenType)) {
  29457. return trans.target;
  29458. } else {
  29459. return null;
  29460. }
  29461. };
  29462. ParserATNSimulator.prototype.getPredsForAmbigAlts = function (ambigAlts, configs, nalts) {
  29463. // REACH=[1|1|[]|0:0, 1|2|[]|0:1]
  29464. // altToPred starts as an array of all null contexts. The entry at index i
  29465. // corresponds to alternative i. altToPred[i] may have one of three values:
  29466. // 1. null: no ATNConfig c is found such that c.alt==i
  29467. // 2. SemanticContext.NONE: At least one ATNConfig c exists such that
  29468. // c.alt==i and c.semanticContext==SemanticContext.NONE. In other words,
  29469. // alt i has at least one unpredicated config.
  29470. // 3. Non-NONE Semantic Context: There exists at least one, and for all
  29471. // ATNConfig c such that c.alt==i, c.semanticContext!=SemanticContext.NONE.
  29472. //
  29473. // From this, it is clear that NONE||anything==NONE.
  29474. //
  29475. var altToPred = [];
  29476. for (var i = 0; i < configs.items.length; i++) {
  29477. var c = configs.items[i];
  29478. if (ambigAlts.contains(c.alt)) {
  29479. altToPred[c.alt] = SemanticContext.orContext(altToPred[c.alt] || null, c.semanticContext);
  29480. }
  29481. }
  29482. var nPredAlts = 0;
  29483. for (i = 1; i < nalts + 1; i++) {
  29484. var pred = altToPred[i] || null;
  29485. if (pred === null) {
  29486. altToPred[i] = SemanticContext.NONE;
  29487. } else if (pred !== SemanticContext.NONE) {
  29488. nPredAlts += 1;
  29489. }
  29490. }
  29491. // nonambig alts are null in altToPred
  29492. if (nPredAlts === 0) {
  29493. altToPred = null;
  29494. }
  29495. if (this.debug) {
  29496. console.log("getPredsForAmbigAlts result " + Utils.arrayToString(altToPred));
  29497. }
  29498. return altToPred;
  29499. };
  29500. ParserATNSimulator.prototype.getPredicatePredictions = function (ambigAlts, altToPred) {
  29501. var pairs = [];
  29502. var containsPredicate = false;
  29503. for (var i = 1; i < altToPred.length; i++) {
  29504. var pred = altToPred[i];
  29505. // unpredicated is indicated by SemanticContext.NONE
  29506. if (ambigAlts !== null && ambigAlts.contains(i)) {
  29507. pairs.push(new PredPrediction(pred, i));
  29508. }
  29509. if (pred !== SemanticContext.NONE) {
  29510. containsPredicate = true;
  29511. }
  29512. }
  29513. if (!containsPredicate) {
  29514. return null;
  29515. }
  29516. return pairs;
  29517. };
  29518. //
  29519. // This method is used to improve the localization of error messages by
  29520. // choosing an alternative rather than throwing a
  29521. // {@link NoViableAltException} in particular prediction scenarios where the
  29522. // {@link //ERROR} state was reached during ATN simulation.
  29523. //
  29524. // <p>
  29525. // The default implementation of this method uses the following
  29526. // algorithm to identify an ATN configuration which successfully parsed the
  29527. // decision entry rule. Choosing such an alternative ensures that the
  29528. // {@link ParserRuleContext} returned by the calling rule will be complete
  29529. // and valid, and the syntax error will be reported later at a more
  29530. // localized location.</p>
  29531. //
  29532. // <ul>
  29533. // <li>If a syntactically valid path or paths reach the end of the decision rule and
  29534. // they are semantically valid if predicated, return the min associated alt.</li>
  29535. // <li>Else, if a semantically invalid but syntactically valid path exist
  29536. // or paths exist, return the minimum associated alt.
  29537. // </li>
  29538. // <li>Otherwise, return {@link ATN//INVALID_ALT_NUMBER}.</li>
  29539. // </ul>
  29540. //
  29541. // <p>
  29542. // In some scenarios, the algorithm described above could predict an
  29543. // alternative which will result in a {@link FailedPredicateException} in
  29544. // the parser. Specifically, this could occur if the <em>only</em> configuration
  29545. // capable of successfully parsing to the end of the decision rule is
  29546. // blocked by a semantic predicate. By choosing this alternative within
  29547. // {@link //adaptivePredict} instead of throwing a
  29548. // {@link NoViableAltException}, the resulting
  29549. // {@link FailedPredicateException} in the parser will identify the specific
  29550. // predicate which is preventing the parser from successfully parsing the
  29551. // decision rule, which helps developers identify and correct logic errors
  29552. // in semantic predicates.
  29553. // </p>
  29554. //
  29555. // @param configs The ATN configurations which were valid immediately before
  29556. // the {@link //ERROR} state was reached
  29557. // @param outerContext The is the \gamma_0 initial parser context from the paper
  29558. // or the parser stack at the instant before prediction commences.
  29559. //
  29560. // @return The value to return from {@link //adaptivePredict}, or
  29561. // {@link ATN//INVALID_ALT_NUMBER} if a suitable alternative was not
  29562. // identified and {@link //adaptivePredict} should report an error instead.
  29563. //
  29564. ParserATNSimulator.prototype.getSynValidOrSemInvalidAltThatFinishedDecisionEntryRule = function (configs, outerContext) {
  29565. var cfgs = this.splitAccordingToSemanticValidity(configs, outerContext);
  29566. var semValidConfigs = cfgs[0];
  29567. var semInvalidConfigs = cfgs[1];
  29568. var alt = this.getAltThatFinishedDecisionEntryRule(semValidConfigs);
  29569. if (alt !== ATN.INVALID_ALT_NUMBER) {
  29570. // semantically/syntactically viable path exists
  29571. return alt;
  29572. }
  29573. // Is there a syntactically valid path with a failed pred?
  29574. if (semInvalidConfigs.items.length > 0) {
  29575. alt = this.getAltThatFinishedDecisionEntryRule(semInvalidConfigs);
  29576. if (alt !== ATN.INVALID_ALT_NUMBER) {
  29577. // syntactically viable path exists
  29578. return alt;
  29579. }
  29580. }
  29581. return ATN.INVALID_ALT_NUMBER;
  29582. };
  29583. ParserATNSimulator.prototype.getAltThatFinishedDecisionEntryRule = function (configs) {
  29584. var alts = [];
  29585. for (var i = 0; i < configs.items.length; i++) {
  29586. var c = configs.items[i];
  29587. if (c.reachesIntoOuterContext > 0 || c.state instanceof RuleStopState && c.context.hasEmptyPath()) {
  29588. if (alts.indexOf(c.alt) < 0) {
  29589. alts.push(c.alt);
  29590. }
  29591. }
  29592. }
  29593. if (alts.length === 0) {
  29594. return ATN.INVALID_ALT_NUMBER;
  29595. } else {
  29596. return Math.min.apply(null, alts);
  29597. }
  29598. };
  29599. // Walk the list of configurations and split them according to
  29600. // those that have preds evaluating to true/false. If no pred, assume
  29601. // true pred and include in succeeded set. Returns Pair of sets.
  29602. //
  29603. // Create a new set so as not to alter the incoming parameter.
  29604. //
  29605. // Assumption: the input stream has been restored to the starting point
  29606. // prediction, which is where predicates need to evaluate.
  29607. //
  29608. ParserATNSimulator.prototype.splitAccordingToSemanticValidity = function (configs, outerContext) {
  29609. var succeeded = new ATNConfigSet(configs.fullCtx);
  29610. var failed = new ATNConfigSet(configs.fullCtx);
  29611. for (var i = 0; i < configs.items.length; i++) {
  29612. var c = configs.items[i];
  29613. if (c.semanticContext !== SemanticContext.NONE) {
  29614. var predicateEvaluationResult = c.semanticContext.evaluate(this.parser, outerContext);
  29615. if (predicateEvaluationResult) {
  29616. succeeded.add(c);
  29617. } else {
  29618. failed.add(c);
  29619. }
  29620. } else {
  29621. succeeded.add(c);
  29622. }
  29623. }
  29624. return [succeeded, failed];
  29625. };
  29626. // Look through a list of predicate/alt pairs, returning alts for the
  29627. // pairs that win. A {@code NONE} predicate indicates an alt containing an
  29628. // unpredicated config which behaves as "always true." If !complete
  29629. // then we stop at the first predicate that evaluates to true. This
  29630. // includes pairs with null predicates.
  29631. //
  29632. ParserATNSimulator.prototype.evalSemanticContext = function (predPredictions, outerContext, complete) {
  29633. var predictions = new BitSet();
  29634. for (var i = 0; i < predPredictions.length; i++) {
  29635. var pair = predPredictions[i];
  29636. if (pair.pred === SemanticContext.NONE) {
  29637. predictions.add(pair.alt);
  29638. if (!complete) {
  29639. break;
  29640. }
  29641. continue;
  29642. }
  29643. var predicateEvaluationResult = pair.pred.evaluate(this.parser, outerContext);
  29644. if (this.debug || this.dfa_debug) {
  29645. console.log("eval pred " + pair + "=" + predicateEvaluationResult);
  29646. }
  29647. if (predicateEvaluationResult) {
  29648. if (this.debug || this.dfa_debug) {
  29649. console.log("PREDICT " + pair.alt);
  29650. }
  29651. predictions.add(pair.alt);
  29652. if (!complete) {
  29653. break;
  29654. }
  29655. }
  29656. }
  29657. return predictions;
  29658. };
  29659. // TODO: If we are doing predicates, there is no point in pursuing
  29660. // closure operations if we reach a DFA state that uniquely predicts
  29661. // alternative. We will not be caching that DFA state and it is a
  29662. // waste to pursue the closure. Might have to advance when we do
  29663. // ambig detection thought :(
  29664. //
  29665. ParserATNSimulator.prototype.closure = function (config, configs, closureBusy, collectPredicates, fullCtx, treatEofAsEpsilon) {
  29666. var initialDepth = 0;
  29667. this.closureCheckingStopState(config, configs, closureBusy, collectPredicates, fullCtx, initialDepth, treatEofAsEpsilon);
  29668. };
  29669. ParserATNSimulator.prototype.closureCheckingStopState = function (config, configs, closureBusy, collectPredicates, fullCtx, depth, treatEofAsEpsilon) {
  29670. if (this.debug || this.debug_closure) {
  29671. console.log("closure(" + config.toString(this.parser, true) + ")");
  29672. // console.log("configs(" + configs.toString() + ")");
  29673. if (config.reachesIntoOuterContext > 50) {
  29674. throw "problem";
  29675. }
  29676. }
  29677. if (config.state instanceof RuleStopState) {
  29678. // We hit rule end. If we have context info, use it
  29679. // run thru all possible stack tops in ctx
  29680. if (!config.context.isEmpty()) {
  29681. for (var i = 0; i < config.context.length; i++) {
  29682. if (config.context.getReturnState(i) === PredictionContext.EMPTY_RETURN_STATE) {
  29683. if (fullCtx) {
  29684. configs.add(new ATNConfig({ state: config.state, context: PredictionContext.EMPTY }, config), this.mergeCache);
  29685. continue;
  29686. } else {
  29687. // we have no context info, just chase follow links (if greedy)
  29688. if (this.debug) {
  29689. console.log("FALLING off rule " + this.getRuleName(config.state.ruleIndex));
  29690. }
  29691. this.closure_(config, configs, closureBusy, collectPredicates, fullCtx, depth, treatEofAsEpsilon);
  29692. }
  29693. continue;
  29694. }
  29695. var returnState = this.atn.states[config.context.getReturnState(i)];
  29696. var newContext = config.context.getParent(i); // "pop" return state
  29697. var parms = { state: returnState, alt: config.alt, context: newContext, semanticContext: config.semanticContext };
  29698. var c = new ATNConfig(parms, null);
  29699. // While we have context to pop back from, we may have
  29700. // gotten that context AFTER having falling off a rule.
  29701. // Make sure we track that we are now out of context.
  29702. c.reachesIntoOuterContext = config.reachesIntoOuterContext;
  29703. this.closureCheckingStopState(c, configs, closureBusy, collectPredicates, fullCtx, depth - 1, treatEofAsEpsilon);
  29704. }
  29705. return;
  29706. } else if (fullCtx) {
  29707. // reached end of start rule
  29708. configs.add(config, this.mergeCache);
  29709. return;
  29710. } else {
  29711. // else if we have no context info, just chase follow links (if greedy)
  29712. if (this.debug) {
  29713. console.log("FALLING off rule " + this.getRuleName(config.state.ruleIndex));
  29714. }
  29715. }
  29716. }
  29717. this.closure_(config, configs, closureBusy, collectPredicates, fullCtx, depth, treatEofAsEpsilon);
  29718. };
  29719. // Do the actual work of walking epsilon edges//
  29720. ParserATNSimulator.prototype.closure_ = function (config, configs, closureBusy, collectPredicates, fullCtx, depth, treatEofAsEpsilon) {
  29721. var p = config.state;
  29722. // optimization
  29723. if (!p.epsilonOnlyTransitions) {
  29724. configs.add(config, this.mergeCache);
  29725. // make sure to not return here, because EOF transitions can act as
  29726. // both epsilon transitions and non-epsilon transitions.
  29727. }
  29728. for (var i = 0; i < p.transitions.length; i++) {
  29729. if (i == 0 && this.canDropLoopEntryEdgeInLeftRecursiveRule(config)) continue;
  29730. var t = p.transitions[i];
  29731. var continueCollecting = collectPredicates && !(t instanceof ActionTransition);
  29732. var c = this.getEpsilonTarget(config, t, continueCollecting, depth === 0, fullCtx, treatEofAsEpsilon);
  29733. if (c !== null) {
  29734. if (!t.isEpsilon && closureBusy.add(c) !== c) {
  29735. // avoid infinite recursion for EOF* and EOF+
  29736. continue;
  29737. }
  29738. var newDepth = depth;
  29739. if (config.state instanceof RuleStopState) {
  29740. // target fell off end of rule; mark resulting c as having dipped into outer context
  29741. // We can't get here if incoming config was rule stop and we had context
  29742. // track how far we dip into outer context. Might
  29743. // come in handy and we avoid evaluating context dependent
  29744. // preds if this is > 0.
  29745. if (closureBusy.add(c) !== c) {
  29746. // avoid infinite recursion for right-recursive rules
  29747. continue;
  29748. }
  29749. if (this._dfa !== null && this._dfa.precedenceDfa) {
  29750. if (t.outermostPrecedenceReturn === this._dfa.atnStartState.ruleIndex) {
  29751. c.precedenceFilterSuppressed = true;
  29752. }
  29753. }
  29754. c.reachesIntoOuterContext += 1;
  29755. configs.dipsIntoOuterContext = true; // TODO: can remove? only care when we add to set per middle of this method
  29756. newDepth -= 1;
  29757. if (this.debug) {
  29758. console.log("dips into outer ctx: " + c);
  29759. }
  29760. } else if (t instanceof RuleTransition) {
  29761. // latch when newDepth goes negative - once we step out of the entry context we can't return
  29762. if (newDepth >= 0) {
  29763. newDepth += 1;
  29764. }
  29765. }
  29766. this.closureCheckingStopState(c, configs, closureBusy, continueCollecting, fullCtx, newDepth, treatEofAsEpsilon);
  29767. }
  29768. }
  29769. };
  29770. ParserATNSimulator.prototype.canDropLoopEntryEdgeInLeftRecursiveRule = function (config) {
  29771. // return False
  29772. var p = config.state;
  29773. // First check to see if we are in StarLoopEntryState generated during
  29774. // left-recursion elimination. For efficiency, also check if
  29775. // the context has an empty stack case. If so, it would mean
  29776. // global FOLLOW so we can't perform optimization
  29777. // Are we the special loop entry/exit state? or SLL wildcard
  29778. if (p.stateType != ATNState.STAR_LOOP_ENTRY) return false;
  29779. if (p.stateType != ATNState.STAR_LOOP_ENTRY || !p.isPrecedenceDecision || config.context.isEmpty() || config.context.hasEmptyPath()) return false;
  29780. // Require all return states to return back to the same rule that p is in.
  29781. var numCtxs = config.context.length;
  29782. for (var i = 0; i < numCtxs; i++) {
  29783. // for each stack context
  29784. var returnState = this.atn.states[config.context.getReturnState(i)];
  29785. if (returnState.ruleIndex != p.ruleIndex) return false;
  29786. }
  29787. var decisionStartState = p.transitions[0].target;
  29788. var blockEndStateNum = decisionStartState.endState.stateNumber;
  29789. var blockEndState = this.atn.states[blockEndStateNum];
  29790. // Verify that the top of each stack context leads to loop entry/exit
  29791. // state through epsilon edges and w/o leaving rule.
  29792. for (var i = 0; i < numCtxs; i++) {
  29793. // for each stack context
  29794. var returnStateNumber = config.context.getReturnState(i);
  29795. var returnState = this.atn.states[returnStateNumber];
  29796. // all states must have single outgoing epsilon edge
  29797. if (returnState.transitions.length != 1 || !returnState.transitions[0].isEpsilon) return false;
  29798. // Look for prefix op case like 'not expr', (' type ')' expr
  29799. var returnStateTarget = returnState.transitions[0].target;
  29800. if (returnState.stateType == ATNState.BLOCK_END && returnStateTarget == p) continue;
  29801. // Look for 'expr op expr' or case where expr's return state is block end
  29802. // of (...)* internal block; the block end points to loop back
  29803. // which points to p but we don't need to check that
  29804. if (returnState == blockEndState) continue;
  29805. // Look for ternary expr ? expr : expr. The return state points at block end,
  29806. // which points at loop entry state
  29807. if (returnStateTarget == blockEndState) continue;
  29808. // Look for complex prefix 'between expr and expr' case where 2nd expr's
  29809. // return state points at block end state of (...)* internal block
  29810. if (returnStateTarget.stateType == ATNState.BLOCK_END && returnStateTarget.transitions.length == 1 && returnStateTarget.transitions[0].isEpsilon && returnStateTarget.transitions[0].target == p) continue;
  29811. // anything else ain't conforming
  29812. return false;
  29813. }
  29814. return true;
  29815. };
  29816. ParserATNSimulator.prototype.getRuleName = function (index) {
  29817. if (this.parser !== null && index >= 0) {
  29818. return this.parser.ruleNames[index];
  29819. } else {
  29820. return "<rule " + index + ">";
  29821. }
  29822. };
  29823. ParserATNSimulator.prototype.getEpsilonTarget = function (config, t, collectPredicates, inContext, fullCtx, treatEofAsEpsilon) {
  29824. switch (t.serializationType) {
  29825. case Transition.RULE:
  29826. return this.ruleTransition(config, t);
  29827. case Transition.PRECEDENCE:
  29828. return this.precedenceTransition(config, t, collectPredicates, inContext, fullCtx);
  29829. case Transition.PREDICATE:
  29830. return this.predTransition(config, t, collectPredicates, inContext, fullCtx);
  29831. case Transition.ACTION:
  29832. return this.actionTransition(config, t);
  29833. case Transition.EPSILON:
  29834. return new ATNConfig({ state: t.target }, config);
  29835. case Transition.ATOM:
  29836. case Transition.RANGE:
  29837. case Transition.SET:
  29838. // EOF transitions act like epsilon transitions after the first EOF
  29839. // transition is traversed
  29840. if (treatEofAsEpsilon) {
  29841. if (t.matches(Token.EOF, 0, 1)) {
  29842. return new ATNConfig({ state: t.target }, config);
  29843. }
  29844. }
  29845. return null;
  29846. default:
  29847. return null;
  29848. }
  29849. };
  29850. ParserATNSimulator.prototype.actionTransition = function (config, t) {
  29851. if (this.debug) {
  29852. var index = t.actionIndex == -1 ? 65535 : t.actionIndex;
  29853. console.log("ACTION edge " + t.ruleIndex + ":" + index);
  29854. }
  29855. return new ATNConfig({ state: t.target }, config);
  29856. };
  29857. ParserATNSimulator.prototype.precedenceTransition = function (config, pt, collectPredicates, inContext, fullCtx) {
  29858. if (this.debug) {
  29859. console.log("PRED (collectPredicates=" + collectPredicates + ") " + pt.precedence + ">=_p, ctx dependent=true");
  29860. if (this.parser !== null) {
  29861. console.log("context surrounding pred is " + Utils.arrayToString(this.parser.getRuleInvocationStack()));
  29862. }
  29863. }
  29864. var c = null;
  29865. if (collectPredicates && inContext) {
  29866. if (fullCtx) {
  29867. // In full context mode, we can evaluate predicates on-the-fly
  29868. // during closure, which dramatically reduces the size of
  29869. // the config sets. It also obviates the need to test predicates
  29870. // later during conflict resolution.
  29871. var currentPosition = this._input.index;
  29872. this._input.seek(this._startIndex);
  29873. var predSucceeds = pt.getPredicate().evaluate(this.parser, this._outerContext);
  29874. this._input.seek(currentPosition);
  29875. if (predSucceeds) {
  29876. c = new ATNConfig({ state: pt.target }, config); // no pred context
  29877. }
  29878. } else {
  29879. var newSemCtx = SemanticContext.andContext(config.semanticContext, pt.getPredicate());
  29880. c = new ATNConfig({ state: pt.target, semanticContext: newSemCtx }, config);
  29881. }
  29882. } else {
  29883. c = new ATNConfig({ state: pt.target }, config);
  29884. }
  29885. if (this.debug) {
  29886. console.log("config from pred transition=" + c);
  29887. }
  29888. return c;
  29889. };
  29890. ParserATNSimulator.prototype.predTransition = function (config, pt, collectPredicates, inContext, fullCtx) {
  29891. if (this.debug) {
  29892. console.log("PRED (collectPredicates=" + collectPredicates + ") " + pt.ruleIndex + ":" + pt.predIndex + ", ctx dependent=" + pt.isCtxDependent);
  29893. if (this.parser !== null) {
  29894. console.log("context surrounding pred is " + Utils.arrayToString(this.parser.getRuleInvocationStack()));
  29895. }
  29896. }
  29897. var c = null;
  29898. if (collectPredicates && (pt.isCtxDependent && inContext || !pt.isCtxDependent)) {
  29899. if (fullCtx) {
  29900. // In full context mode, we can evaluate predicates on-the-fly
  29901. // during closure, which dramatically reduces the size of
  29902. // the config sets. It also obviates the need to test predicates
  29903. // later during conflict resolution.
  29904. var currentPosition = this._input.index;
  29905. this._input.seek(this._startIndex);
  29906. var predSucceeds = pt.getPredicate().evaluate(this.parser, this._outerContext);
  29907. this._input.seek(currentPosition);
  29908. if (predSucceeds) {
  29909. c = new ATNConfig({ state: pt.target }, config); // no pred context
  29910. }
  29911. } else {
  29912. var newSemCtx = SemanticContext.andContext(config.semanticContext, pt.getPredicate());
  29913. c = new ATNConfig({ state: pt.target, semanticContext: newSemCtx }, config);
  29914. }
  29915. } else {
  29916. c = new ATNConfig({ state: pt.target }, config);
  29917. }
  29918. if (this.debug) {
  29919. console.log("config from pred transition=" + c);
  29920. }
  29921. return c;
  29922. };
  29923. ParserATNSimulator.prototype.ruleTransition = function (config, t) {
  29924. if (this.debug) {
  29925. console.log("CALL rule " + this.getRuleName(t.target.ruleIndex) + ", ctx=" + config.context);
  29926. }
  29927. var returnState = t.followState;
  29928. var newContext = SingletonPredictionContext.create(config.context, returnState.stateNumber);
  29929. return new ATNConfig({ state: t.target, context: newContext }, config);
  29930. };
  29931. ParserATNSimulator.prototype.getConflictingAlts = function (configs) {
  29932. var altsets = PredictionMode.getConflictingAltSubsets(configs);
  29933. return PredictionMode.getAlts(altsets);
  29934. };
  29935. // Sam pointed out a problem with the previous definition, v3, of
  29936. // ambiguous states. If we have another state associated with conflicting
  29937. // alternatives, we should keep going. For example, the following grammar
  29938. //
  29939. // s : (ID | ID ID?) ';' ;
  29940. //
  29941. // When the ATN simulation reaches the state before ';', it has a DFA
  29942. // state that looks like: [12|1|[], 6|2|[], 12|2|[]]. Naturally
  29943. // 12|1|[] and 12|2|[] conflict, but we cannot stop processing this node
  29944. // because alternative to has another way to continue, via [6|2|[]].
  29945. // The key is that we have a single state that has config's only associated
  29946. // with a single alternative, 2, and crucially the state transitions
  29947. // among the configurations are all non-epsilon transitions. That means
  29948. // we don't consider any conflicts that include alternative 2. So, we
  29949. // ignore the conflict between alts 1 and 2. We ignore a set of
  29950. // conflicting alts when there is an intersection with an alternative
  29951. // associated with a single alt state in the state&rarr;config-list map.
  29952. //
  29953. // It's also the case that we might have two conflicting configurations but
  29954. // also a 3rd nonconflicting configuration for a different alternative:
  29955. // [1|1|[], 1|2|[], 8|3|[]]. This can come about from grammar:
  29956. //
  29957. // a : A | A | A B ;
  29958. //
  29959. // After matching input A, we reach the stop state for rule A, state 1.
  29960. // State 8 is the state right before B. Clearly alternatives 1 and 2
  29961. // conflict and no amount of further lookahead will separate the two.
  29962. // However, alternative 3 will be able to continue and so we do not
  29963. // stop working on this state. In the previous example, we're concerned
  29964. // with states associated with the conflicting alternatives. Here alt
  29965. // 3 is not associated with the conflicting configs, but since we can continue
  29966. // looking for input reasonably, I don't declare the state done. We
  29967. // ignore a set of conflicting alts when we have an alternative
  29968. // that we still need to pursue.
  29969. //
  29970. ParserATNSimulator.prototype.getConflictingAltsOrUniqueAlt = function (configs) {
  29971. var conflictingAlts = null;
  29972. if (configs.uniqueAlt !== ATN.INVALID_ALT_NUMBER) {
  29973. conflictingAlts = new BitSet();
  29974. conflictingAlts.add(configs.uniqueAlt);
  29975. } else {
  29976. conflictingAlts = configs.conflictingAlts;
  29977. }
  29978. return conflictingAlts;
  29979. };
  29980. ParserATNSimulator.prototype.getTokenName = function (t) {
  29981. if (t === Token.EOF) {
  29982. return "EOF";
  29983. }
  29984. if (this.parser !== null && this.parser.literalNames !== null) {
  29985. if (t >= this.parser.literalNames.length && t >= this.parser.symbolicNames.length) {
  29986. console.log("" + t + " ttype out of range: " + this.parser.literalNames);
  29987. console.log("" + this.parser.getInputStream().getTokens());
  29988. } else {
  29989. var name = this.parser.literalNames[t] || this.parser.symbolicNames[t];
  29990. return name + "<" + t + ">";
  29991. }
  29992. }
  29993. return "" + t;
  29994. };
  29995. ParserATNSimulator.prototype.getLookaheadName = function (input) {
  29996. return this.getTokenName(input.LA(1));
  29997. };
  29998. // Used for debugging in adaptivePredict around execATN but I cut
  29999. // it out for clarity now that alg. works well. We can leave this
  30000. // "dead" code for a bit.
  30001. //
  30002. ParserATNSimulator.prototype.dumpDeadEndConfigs = function (nvae) {
  30003. console.log("dead end configs: ");
  30004. var decs = nvae.getDeadEndConfigs();
  30005. for (var i = 0; i < decs.length; i++) {
  30006. var c = decs[i];
  30007. var trans = "no edges";
  30008. if (c.state.transitions.length > 0) {
  30009. var t = c.state.transitions[0];
  30010. if (t instanceof AtomTransition) {
  30011. trans = "Atom " + this.getTokenName(t.label);
  30012. } else if (t instanceof SetTransition) {
  30013. var neg = t instanceof NotSetTransition;
  30014. trans = (neg ? "~" : "") + "Set " + t.set;
  30015. }
  30016. }
  30017. console.error(c.toString(this.parser, true) + ":" + trans);
  30018. }
  30019. };
  30020. ParserATNSimulator.prototype.noViableAlt = function (input, outerContext, configs, startIndex) {
  30021. return new NoViableAltException(this.parser, input, input.get(startIndex), input.LT(1), configs, outerContext);
  30022. };
  30023. ParserATNSimulator.prototype.getUniqueAlt = function (configs) {
  30024. var alt = ATN.INVALID_ALT_NUMBER;
  30025. for (var i = 0; i < configs.items.length; i++) {
  30026. var c = configs.items[i];
  30027. if (alt === ATN.INVALID_ALT_NUMBER) {
  30028. alt = c.alt; // found first alt
  30029. } else if (c.alt !== alt) {
  30030. return ATN.INVALID_ALT_NUMBER;
  30031. }
  30032. }
  30033. return alt;
  30034. };
  30035. //
  30036. // Add an edge to the DFA, if possible. This method calls
  30037. // {@link //addDFAState} to ensure the {@code to} state is present in the
  30038. // DFA. If {@code from} is {@code null}, or if {@code t} is outside the
  30039. // range of edges that can be represented in the DFA tables, this method
  30040. // returns without adding the edge to the DFA.
  30041. //
  30042. // <p>If {@code to} is {@code null}, this method returns {@code null}.
  30043. // Otherwise, this method returns the {@link DFAState} returned by calling
  30044. // {@link //addDFAState} for the {@code to} state.</p>
  30045. //
  30046. // @param dfa The DFA
  30047. // @param from The source state for the edge
  30048. // @param t The input symbol
  30049. // @param to The target state for the edge
  30050. //
  30051. // @return If {@code to} is {@code null}, this method returns {@code null};
  30052. // otherwise this method returns the result of calling {@link //addDFAState}
  30053. // on {@code to}
  30054. //
  30055. ParserATNSimulator.prototype.addDFAEdge = function (dfa, from_, t, to) {
  30056. if (this.debug) {
  30057. console.log("EDGE " + from_ + " -> " + to + " upon " + this.getTokenName(t));
  30058. }
  30059. if (to === null) {
  30060. return null;
  30061. }
  30062. to = this.addDFAState(dfa, to); // used existing if possible not incoming
  30063. if (from_ === null || t < -1 || t > this.atn.maxTokenType) {
  30064. return to;
  30065. }
  30066. if (from_.edges === null) {
  30067. from_.edges = [];
  30068. }
  30069. from_.edges[t + 1] = to; // connect
  30070. if (this.debug) {
  30071. var literalNames = this.parser === null ? null : this.parser.literalNames;
  30072. var symbolicNames = this.parser === null ? null : this.parser.symbolicNames;
  30073. console.log("DFA=\n" + dfa.toString(literalNames, symbolicNames));
  30074. }
  30075. return to;
  30076. };
  30077. //
  30078. // Add state {@code D} to the DFA if it is not already present, and return
  30079. // the actual instance stored in the DFA. If a state equivalent to {@code D}
  30080. // is already in the DFA, the existing state is returned. Otherwise this
  30081. // method returns {@code D} after adding it to the DFA.
  30082. //
  30083. // <p>If {@code D} is {@link //ERROR}, this method returns {@link //ERROR} and
  30084. // does not change the DFA.</p>
  30085. //
  30086. // @param dfa The dfa
  30087. // @param D The DFA state to add
  30088. // @return The state stored in the DFA. This will be either the existing
  30089. // state if {@code D} is already in the DFA, or {@code D} itself if the
  30090. // state was not already present.
  30091. //
  30092. ParserATNSimulator.prototype.addDFAState = function (dfa, D) {
  30093. if (D == ATNSimulator.ERROR) {
  30094. return D;
  30095. }
  30096. var existing = dfa.states.get(D);
  30097. if (existing !== null) {
  30098. return existing;
  30099. }
  30100. D.stateNumber = dfa.states.length;
  30101. if (!D.configs.readOnly) {
  30102. D.configs.optimizeConfigs(this);
  30103. D.configs.setReadonly(true);
  30104. }
  30105. dfa.states.add(D);
  30106. if (this.debug) {
  30107. console.log("adding new DFA state: " + D);
  30108. }
  30109. return D;
  30110. };
  30111. ParserATNSimulator.prototype.reportAttemptingFullContext = function (dfa, conflictingAlts, configs, startIndex, stopIndex) {
  30112. if (this.debug || this.retry_debug) {
  30113. var interval = new Interval(startIndex, stopIndex + 1);
  30114. console.log("reportAttemptingFullContext decision=" + dfa.decision + ":" + configs + ", input=" + this.parser.getTokenStream().getText(interval));
  30115. }
  30116. if (this.parser !== null) {
  30117. this.parser.getErrorListenerDispatch().reportAttemptingFullContext(this.parser, dfa, startIndex, stopIndex, conflictingAlts, configs);
  30118. }
  30119. };
  30120. ParserATNSimulator.prototype.reportContextSensitivity = function (dfa, prediction, configs, startIndex, stopIndex) {
  30121. if (this.debug || this.retry_debug) {
  30122. var interval = new Interval(startIndex, stopIndex + 1);
  30123. console.log("reportContextSensitivity decision=" + dfa.decision + ":" + configs + ", input=" + this.parser.getTokenStream().getText(interval));
  30124. }
  30125. if (this.parser !== null) {
  30126. this.parser.getErrorListenerDispatch().reportContextSensitivity(this.parser, dfa, startIndex, stopIndex, prediction, configs);
  30127. }
  30128. };
  30129. // If context sensitive parsing, we know it's ambiguity not conflict//
  30130. ParserATNSimulator.prototype.reportAmbiguity = function (dfa, D, startIndex, stopIndex, exact, ambigAlts, configs) {
  30131. if (this.debug || this.retry_debug) {
  30132. var interval = new Interval(startIndex, stopIndex + 1);
  30133. console.log("reportAmbiguity " + ambigAlts + ":" + configs + ", input=" + this.parser.getTokenStream().getText(interval));
  30134. }
  30135. if (this.parser !== null) {
  30136. this.parser.getErrorListenerDispatch().reportAmbiguity(this.parser, dfa, startIndex, stopIndex, exact, ambigAlts, configs);
  30137. }
  30138. };
  30139. exports.ParserATNSimulator = ParserATNSimulator;
  30140. /***/ }),
  30141. /***/ "./node_modules/antlr4/atn/PredictionMode.js":
  30142. /*!***************************************************!*\
  30143. !*** ./node_modules/antlr4/atn/PredictionMode.js ***!
  30144. \***************************************************/
  30145. /*! no static exports found */
  30146. /***/ (function(module, exports, __webpack_require__) {
  30147. "use strict";
  30148. //
  30149. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  30150. * Use of this file is governed by the BSD 3-clause license that
  30151. * can be found in the LICENSE.txt file in the project root.
  30152. */
  30153. //
  30154. //
  30155. // This enumeration defines the prediction modes available in ANTLR 4 along with
  30156. // utility methods for analyzing configuration sets for conflicts and/or
  30157. // ambiguities.
  30158. var Set = __webpack_require__(/*! ./../Utils */ "./node_modules/antlr4/Utils.js").Set;
  30159. var Map = __webpack_require__(/*! ./../Utils */ "./node_modules/antlr4/Utils.js").Map;
  30160. var BitSet = __webpack_require__(/*! ./../Utils */ "./node_modules/antlr4/Utils.js").BitSet;
  30161. var AltDict = __webpack_require__(/*! ./../Utils */ "./node_modules/antlr4/Utils.js").AltDict;
  30162. var ATN = __webpack_require__(/*! ./ATN */ "./node_modules/antlr4/atn/ATN.js").ATN;
  30163. var RuleStopState = __webpack_require__(/*! ./ATNState */ "./node_modules/antlr4/atn/ATNState.js").RuleStopState;
  30164. var ATNConfigSet = __webpack_require__(/*! ./ATNConfigSet */ "./node_modules/antlr4/atn/ATNConfigSet.js").ATNConfigSet;
  30165. var ATNConfig = __webpack_require__(/*! ./ATNConfig */ "./node_modules/antlr4/atn/ATNConfig.js").ATNConfig;
  30166. var SemanticContext = __webpack_require__(/*! ./SemanticContext */ "./node_modules/antlr4/atn/SemanticContext.js").SemanticContext;
  30167. var Hash = __webpack_require__(/*! ../Utils */ "./node_modules/antlr4/Utils.js").Hash;
  30168. var hashStuff = __webpack_require__(/*! ./../Utils */ "./node_modules/antlr4/Utils.js").hashStuff;
  30169. var equalArrays = __webpack_require__(/*! ./../Utils */ "./node_modules/antlr4/Utils.js").equalArrays;
  30170. function PredictionMode() {
  30171. return this;
  30172. }
  30173. //
  30174. // The SLL(*) prediction mode. This prediction mode ignores the current
  30175. // parser context when making predictions. This is the fastest prediction
  30176. // mode, and provides correct results for many grammars. This prediction
  30177. // mode is more powerful than the prediction mode provided by ANTLR 3, but
  30178. // may result in syntax errors for grammar and input combinations which are
  30179. // not SLL.
  30180. //
  30181. // <p>
  30182. // When using this prediction mode, the parser will either return a correct
  30183. // parse tree (i.e. the same parse tree that would be returned with the
  30184. // {@link //LL} prediction mode), or it will report a syntax error. If a
  30185. // syntax error is encountered when using the {@link //SLL} prediction mode,
  30186. // it may be due to either an actual syntax error in the input or indicate
  30187. // that the particular combination of grammar and input requires the more
  30188. // powerful {@link //LL} prediction abilities to complete successfully.</p>
  30189. //
  30190. // <p>
  30191. // This prediction mode does not provide any guarantees for prediction
  30192. // behavior for syntactically-incorrect inputs.</p>
  30193. //
  30194. PredictionMode.SLL = 0;
  30195. //
  30196. // The LL(*) prediction mode. This prediction mode allows the current parser
  30197. // context to be used for resolving SLL conflicts that occur during
  30198. // prediction. This is the fastest prediction mode that guarantees correct
  30199. // parse results for all combinations of grammars with syntactically correct
  30200. // inputs.
  30201. //
  30202. // <p>
  30203. // When using this prediction mode, the parser will make correct decisions
  30204. // for all syntactically-correct grammar and input combinations. However, in
  30205. // cases where the grammar is truly ambiguous this prediction mode might not
  30206. // report a precise answer for <em>exactly which</em> alternatives are
  30207. // ambiguous.</p>
  30208. //
  30209. // <p>
  30210. // This prediction mode does not provide any guarantees for prediction
  30211. // behavior for syntactically-incorrect inputs.</p>
  30212. //
  30213. PredictionMode.LL = 1;
  30214. //
  30215. // The LL(*) prediction mode with exact ambiguity detection. In addition to
  30216. // the correctness guarantees provided by the {@link //LL} prediction mode,
  30217. // this prediction mode instructs the prediction algorithm to determine the
  30218. // complete and exact set of ambiguous alternatives for every ambiguous
  30219. // decision encountered while parsing.
  30220. //
  30221. // <p>
  30222. // This prediction mode may be used for diagnosing ambiguities during
  30223. // grammar development. Due to the performance overhead of calculating sets
  30224. // of ambiguous alternatives, this prediction mode should be avoided when
  30225. // the exact results are not necessary.</p>
  30226. //
  30227. // <p>
  30228. // This prediction mode does not provide any guarantees for prediction
  30229. // behavior for syntactically-incorrect inputs.</p>
  30230. //
  30231. PredictionMode.LL_EXACT_AMBIG_DETECTION = 2;
  30232. //
  30233. // Computes the SLL prediction termination condition.
  30234. //
  30235. // <p>
  30236. // This method computes the SLL prediction termination condition for both of
  30237. // the following cases.</p>
  30238. //
  30239. // <ul>
  30240. // <li>The usual SLL+LL fallback upon SLL conflict</li>
  30241. // <li>Pure SLL without LL fallback</li>
  30242. // </ul>
  30243. //
  30244. // <p><strong>COMBINED SLL+LL PARSING</strong></p>
  30245. //
  30246. // <p>When LL-fallback is enabled upon SLL conflict, correct predictions are
  30247. // ensured regardless of how the termination condition is computed by this
  30248. // method. Due to the substantially higher cost of LL prediction, the
  30249. // prediction should only fall back to LL when the additional lookahead
  30250. // cannot lead to a unique SLL prediction.</p>
  30251. //
  30252. // <p>Assuming combined SLL+LL parsing, an SLL configuration set with only
  30253. // conflicting subsets should fall back to full LL, even if the
  30254. // configuration sets don't resolve to the same alternative (e.g.
  30255. // {@code {1,2}} and {@code {3,4}}. If there is at least one non-conflicting
  30256. // configuration, SLL could continue with the hopes that more lookahead will
  30257. // resolve via one of those non-conflicting configurations.</p>
  30258. //
  30259. // <p>Here's the prediction termination rule them: SLL (for SLL+LL parsing)
  30260. // stops when it sees only conflicting configuration subsets. In contrast,
  30261. // full LL keeps going when there is uncertainty.</p>
  30262. //
  30263. // <p><strong>HEURISTIC</strong></p>
  30264. //
  30265. // <p>As a heuristic, we stop prediction when we see any conflicting subset
  30266. // unless we see a state that only has one alternative associated with it.
  30267. // The single-alt-state thing lets prediction continue upon rules like
  30268. // (otherwise, it would admit defeat too soon):</p>
  30269. //
  30270. // <p>{@code [12|1|[], 6|2|[], 12|2|[]]. s : (ID | ID ID?) ';' ;}</p>
  30271. //
  30272. // <p>When the ATN simulation reaches the state before {@code ';'}, it has a
  30273. // DFA state that looks like: {@code [12|1|[], 6|2|[], 12|2|[]]}. Naturally
  30274. // {@code 12|1|[]} and {@code 12|2|[]} conflict, but we cannot stop
  30275. // processing this node because alternative to has another way to continue,
  30276. // via {@code [6|2|[]]}.</p>
  30277. //
  30278. // <p>It also let's us continue for this rule:</p>
  30279. //
  30280. // <p>{@code [1|1|[], 1|2|[], 8|3|[]] a : A | A | A B ;}</p>
  30281. //
  30282. // <p>After matching input A, we reach the stop state for rule A, state 1.
  30283. // State 8 is the state right before B. Clearly alternatives 1 and 2
  30284. // conflict and no amount of further lookahead will separate the two.
  30285. // However, alternative 3 will be able to continue and so we do not stop
  30286. // working on this state. In the previous example, we're concerned with
  30287. // states associated with the conflicting alternatives. Here alt 3 is not
  30288. // associated with the conflicting configs, but since we can continue
  30289. // looking for input reasonably, don't declare the state done.</p>
  30290. //
  30291. // <p><strong>PURE SLL PARSING</strong></p>
  30292. //
  30293. // <p>To handle pure SLL parsing, all we have to do is make sure that we
  30294. // combine stack contexts for configurations that differ only by semantic
  30295. // predicate. From there, we can do the usual SLL termination heuristic.</p>
  30296. //
  30297. // <p><strong>PREDICATES IN SLL+LL PARSING</strong></p>
  30298. //
  30299. // <p>SLL decisions don't evaluate predicates until after they reach DFA stop
  30300. // states because they need to create the DFA cache that works in all
  30301. // semantic situations. In contrast, full LL evaluates predicates collected
  30302. // during start state computation so it can ignore predicates thereafter.
  30303. // This means that SLL termination detection can totally ignore semantic
  30304. // predicates.</p>
  30305. //
  30306. // <p>Implementation-wise, {@link ATNConfigSet} combines stack contexts but not
  30307. // semantic predicate contexts so we might see two configurations like the
  30308. // following.</p>
  30309. //
  30310. // <p>{@code (s, 1, x, {}), (s, 1, x', {p})}</p>
  30311. //
  30312. // <p>Before testing these configurations against others, we have to merge
  30313. // {@code x} and {@code x'} (without modifying the existing configurations).
  30314. // For example, we test {@code (x+x')==x''} when looking for conflicts in
  30315. // the following configurations.</p>
  30316. //
  30317. // <p>{@code (s, 1, x, {}), (s, 1, x', {p}), (s, 2, x'', {})}</p>
  30318. //
  30319. // <p>If the configuration set has predicates (as indicated by
  30320. // {@link ATNConfigSet//hasSemanticContext}), this algorithm makes a copy of
  30321. // the configurations to strip out all of the predicates so that a standard
  30322. // {@link ATNConfigSet} will merge everything ignoring predicates.</p>
  30323. //
  30324. PredictionMode.hasSLLConflictTerminatingPrediction = function (mode, configs) {
  30325. // Configs in rule stop states indicate reaching the end of the decision
  30326. // rule (local context) or end of start rule (full context). If all
  30327. // configs meet this condition, then none of the configurations is able
  30328. // to match additional input so we terminate prediction.
  30329. //
  30330. if (PredictionMode.allConfigsInRuleStopStates(configs)) {
  30331. return true;
  30332. }
  30333. // pure SLL mode parsing
  30334. if (mode === PredictionMode.SLL) {
  30335. // Don't bother with combining configs from different semantic
  30336. // contexts if we can fail over to full LL; costs more time
  30337. // since we'll often fail over anyway.
  30338. if (configs.hasSemanticContext) {
  30339. // dup configs, tossing out semantic predicates
  30340. var dup = new ATNConfigSet();
  30341. for (var i = 0; i < configs.items.length; i++) {
  30342. var c = configs.items[i];
  30343. c = new ATNConfig({ semanticContext: SemanticContext.NONE }, c);
  30344. dup.add(c);
  30345. }
  30346. configs = dup;
  30347. }
  30348. // now we have combined contexts for configs with dissimilar preds
  30349. }
  30350. // pure SLL or combined SLL+LL mode parsing
  30351. var altsets = PredictionMode.getConflictingAltSubsets(configs);
  30352. return PredictionMode.hasConflictingAltSet(altsets) && !PredictionMode.hasStateAssociatedWithOneAlt(configs);
  30353. };
  30354. // Checks if any configuration in {@code configs} is in a
  30355. // {@link RuleStopState}. Configurations meeting this condition have reached
  30356. // the end of the decision rule (local context) or end of start rule (full
  30357. // context).
  30358. //
  30359. // @param configs the configuration set to test
  30360. // @return {@code true} if any configuration in {@code configs} is in a
  30361. // {@link RuleStopState}, otherwise {@code false}
  30362. PredictionMode.hasConfigInRuleStopState = function (configs) {
  30363. for (var i = 0; i < configs.items.length; i++) {
  30364. var c = configs.items[i];
  30365. if (c.state instanceof RuleStopState) {
  30366. return true;
  30367. }
  30368. }
  30369. return false;
  30370. };
  30371. // Checks if all configurations in {@code configs} are in a
  30372. // {@link RuleStopState}. Configurations meeting this condition have reached
  30373. // the end of the decision rule (local context) or end of start rule (full
  30374. // context).
  30375. //
  30376. // @param configs the configuration set to test
  30377. // @return {@code true} if all configurations in {@code configs} are in a
  30378. // {@link RuleStopState}, otherwise {@code false}
  30379. PredictionMode.allConfigsInRuleStopStates = function (configs) {
  30380. for (var i = 0; i < configs.items.length; i++) {
  30381. var c = configs.items[i];
  30382. if (!(c.state instanceof RuleStopState)) {
  30383. return false;
  30384. }
  30385. }
  30386. return true;
  30387. };
  30388. //
  30389. // Full LL prediction termination.
  30390. //
  30391. // <p>Can we stop looking ahead during ATN simulation or is there some
  30392. // uncertainty as to which alternative we will ultimately pick, after
  30393. // consuming more input? Even if there are partial conflicts, we might know
  30394. // that everything is going to resolve to the same minimum alternative. That
  30395. // means we can stop since no more lookahead will change that fact. On the
  30396. // other hand, there might be multiple conflicts that resolve to different
  30397. // minimums. That means we need more look ahead to decide which of those
  30398. // alternatives we should predict.</p>
  30399. //
  30400. // <p>The basic idea is to split the set of configurations {@code C}, into
  30401. // conflicting subsets {@code (s, _, ctx, _)} and singleton subsets with
  30402. // non-conflicting configurations. Two configurations conflict if they have
  30403. // identical {@link ATNConfig//state} and {@link ATNConfig//context} values
  30404. // but different {@link ATNConfig//alt} value, e.g. {@code (s, i, ctx, _)}
  30405. // and {@code (s, j, ctx, _)} for {@code i!=j}.</p>
  30406. //
  30407. // <p>Reduce these configuration subsets to the set of possible alternatives.
  30408. // You can compute the alternative subsets in one pass as follows:</p>
  30409. //
  30410. // <p>{@code A_s,ctx = {i | (s, i, ctx, _)}} for each configuration in
  30411. // {@code C} holding {@code s} and {@code ctx} fixed.</p>
  30412. //
  30413. // <p>Or in pseudo-code, for each configuration {@code c} in {@code C}:</p>
  30414. //
  30415. // <pre>
  30416. // map[c] U= c.{@link ATNConfig//alt alt} // map hash/equals uses s and x, not
  30417. // alt and not pred
  30418. // </pre>
  30419. //
  30420. // <p>The values in {@code map} are the set of {@code A_s,ctx} sets.</p>
  30421. //
  30422. // <p>If {@code |A_s,ctx|=1} then there is no conflict associated with
  30423. // {@code s} and {@code ctx}.</p>
  30424. //
  30425. // <p>Reduce the subsets to singletons by choosing a minimum of each subset. If
  30426. // the union of these alternative subsets is a singleton, then no amount of
  30427. // more lookahead will help us. We will always pick that alternative. If,
  30428. // however, there is more than one alternative, then we are uncertain which
  30429. // alternative to predict and must continue looking for resolution. We may
  30430. // or may not discover an ambiguity in the future, even if there are no
  30431. // conflicting subsets this round.</p>
  30432. //
  30433. // <p>The biggest sin is to terminate early because it means we've made a
  30434. // decision but were uncertain as to the eventual outcome. We haven't used
  30435. // enough lookahead. On the other hand, announcing a conflict too late is no
  30436. // big deal; you will still have the conflict. It's just inefficient. It
  30437. // might even look until the end of file.</p>
  30438. //
  30439. // <p>No special consideration for semantic predicates is required because
  30440. // predicates are evaluated on-the-fly for full LL prediction, ensuring that
  30441. // no configuration contains a semantic context during the termination
  30442. // check.</p>
  30443. //
  30444. // <p><strong>CONFLICTING CONFIGS</strong></p>
  30445. //
  30446. // <p>Two configurations {@code (s, i, x)} and {@code (s, j, x')}, conflict
  30447. // when {@code i!=j} but {@code x=x'}. Because we merge all
  30448. // {@code (s, i, _)} configurations together, that means that there are at
  30449. // most {@code n} configurations associated with state {@code s} for
  30450. // {@code n} possible alternatives in the decision. The merged stacks
  30451. // complicate the comparison of configuration contexts {@code x} and
  30452. // {@code x'}. Sam checks to see if one is a subset of the other by calling
  30453. // merge and checking to see if the merged result is either {@code x} or
  30454. // {@code x'}. If the {@code x} associated with lowest alternative {@code i}
  30455. // is the superset, then {@code i} is the only possible prediction since the
  30456. // others resolve to {@code min(i)} as well. However, if {@code x} is
  30457. // associated with {@code j>i} then at least one stack configuration for
  30458. // {@code j} is not in conflict with alternative {@code i}. The algorithm
  30459. // should keep going, looking for more lookahead due to the uncertainty.</p>
  30460. //
  30461. // <p>For simplicity, I'm doing a equality check between {@code x} and
  30462. // {@code x'} that lets the algorithm continue to consume lookahead longer
  30463. // than necessary. The reason I like the equality is of course the
  30464. // simplicity but also because that is the test you need to detect the
  30465. // alternatives that are actually in conflict.</p>
  30466. //
  30467. // <p><strong>CONTINUE/STOP RULE</strong></p>
  30468. //
  30469. // <p>Continue if union of resolved alternative sets from non-conflicting and
  30470. // conflicting alternative subsets has more than one alternative. We are
  30471. // uncertain about which alternative to predict.</p>
  30472. //
  30473. // <p>The complete set of alternatives, {@code [i for (_,i,_)]}, tells us which
  30474. // alternatives are still in the running for the amount of input we've
  30475. // consumed at this point. The conflicting sets let us to strip away
  30476. // configurations that won't lead to more states because we resolve
  30477. // conflicts to the configuration with a minimum alternate for the
  30478. // conflicting set.</p>
  30479. //
  30480. // <p><strong>CASES</strong></p>
  30481. //
  30482. // <ul>
  30483. //
  30484. // <li>no conflicts and more than 1 alternative in set =&gt; continue</li>
  30485. //
  30486. // <li> {@code (s, 1, x)}, {@code (s, 2, x)}, {@code (s, 3, z)},
  30487. // {@code (s', 1, y)}, {@code (s', 2, y)} yields non-conflicting set
  30488. // {@code {3}} U conflicting sets {@code min({1,2})} U {@code min({1,2})} =
  30489. // {@code {1,3}} =&gt; continue
  30490. // </li>
  30491. //
  30492. // <li>{@code (s, 1, x)}, {@code (s, 2, x)}, {@code (s', 1, y)},
  30493. // {@code (s', 2, y)}, {@code (s'', 1, z)} yields non-conflicting set
  30494. // {@code {1}} U conflicting sets {@code min({1,2})} U {@code min({1,2})} =
  30495. // {@code {1}} =&gt; stop and predict 1</li>
  30496. //
  30497. // <li>{@code (s, 1, x)}, {@code (s, 2, x)}, {@code (s', 1, y)},
  30498. // {@code (s', 2, y)} yields conflicting, reduced sets {@code {1}} U
  30499. // {@code {1}} = {@code {1}} =&gt; stop and predict 1, can announce
  30500. // ambiguity {@code {1,2}}</li>
  30501. //
  30502. // <li>{@code (s, 1, x)}, {@code (s, 2, x)}, {@code (s', 2, y)},
  30503. // {@code (s', 3, y)} yields conflicting, reduced sets {@code {1}} U
  30504. // {@code {2}} = {@code {1,2}} =&gt; continue</li>
  30505. //
  30506. // <li>{@code (s, 1, x)}, {@code (s, 2, x)}, {@code (s', 3, y)},
  30507. // {@code (s', 4, y)} yields conflicting, reduced sets {@code {1}} U
  30508. // {@code {3}} = {@code {1,3}} =&gt; continue</li>
  30509. //
  30510. // </ul>
  30511. //
  30512. // <p><strong>EXACT AMBIGUITY DETECTION</strong></p>
  30513. //
  30514. // <p>If all states report the same conflicting set of alternatives, then we
  30515. // know we have the exact ambiguity set.</p>
  30516. //
  30517. // <p><code>|A_<em>i</em>|&gt;1</code> and
  30518. // <code>A_<em>i</em> = A_<em>j</em></code> for all <em>i</em>, <em>j</em>.</p>
  30519. //
  30520. // <p>In other words, we continue examining lookahead until all {@code A_i}
  30521. // have more than one alternative and all {@code A_i} are the same. If
  30522. // {@code A={{1,2}, {1,3}}}, then regular LL prediction would terminate
  30523. // because the resolved set is {@code {1}}. To determine what the real
  30524. // ambiguity is, we have to know whether the ambiguity is between one and
  30525. // two or one and three so we keep going. We can only stop prediction when
  30526. // we need exact ambiguity detection when the sets look like
  30527. // {@code A={{1,2}}} or {@code {{1,2},{1,2}}}, etc...</p>
  30528. //
  30529. PredictionMode.resolvesToJustOneViableAlt = function (altsets) {
  30530. return PredictionMode.getSingleViableAlt(altsets);
  30531. };
  30532. //
  30533. // Determines if every alternative subset in {@code altsets} contains more
  30534. // than one alternative.
  30535. //
  30536. // @param altsets a collection of alternative subsets
  30537. // @return {@code true} if every {@link BitSet} in {@code altsets} has
  30538. // {@link BitSet//cardinality cardinality} &gt; 1, otherwise {@code false}
  30539. //
  30540. PredictionMode.allSubsetsConflict = function (altsets) {
  30541. return !PredictionMode.hasNonConflictingAltSet(altsets);
  30542. };
  30543. //
  30544. // Determines if any single alternative subset in {@code altsets} contains
  30545. // exactly one alternative.
  30546. //
  30547. // @param altsets a collection of alternative subsets
  30548. // @return {@code true} if {@code altsets} contains a {@link BitSet} with
  30549. // {@link BitSet//cardinality cardinality} 1, otherwise {@code false}
  30550. //
  30551. PredictionMode.hasNonConflictingAltSet = function (altsets) {
  30552. for (var i = 0; i < altsets.length; i++) {
  30553. var alts = altsets[i];
  30554. if (alts.length === 1) {
  30555. return true;
  30556. }
  30557. }
  30558. return false;
  30559. };
  30560. //
  30561. // Determines if any single alternative subset in {@code altsets} contains
  30562. // more than one alternative.
  30563. //
  30564. // @param altsets a collection of alternative subsets
  30565. // @return {@code true} if {@code altsets} contains a {@link BitSet} with
  30566. // {@link BitSet//cardinality cardinality} &gt; 1, otherwise {@code false}
  30567. //
  30568. PredictionMode.hasConflictingAltSet = function (altsets) {
  30569. for (var i = 0; i < altsets.length; i++) {
  30570. var alts = altsets[i];
  30571. if (alts.length > 1) {
  30572. return true;
  30573. }
  30574. }
  30575. return false;
  30576. };
  30577. //
  30578. // Determines if every alternative subset in {@code altsets} is equivalent.
  30579. //
  30580. // @param altsets a collection of alternative subsets
  30581. // @return {@code true} if every member of {@code altsets} is equal to the
  30582. // others, otherwise {@code false}
  30583. //
  30584. PredictionMode.allSubsetsEqual = function (altsets) {
  30585. var first = null;
  30586. for (var i = 0; i < altsets.length; i++) {
  30587. var alts = altsets[i];
  30588. if (first === null) {
  30589. first = alts;
  30590. } else if (alts !== first) {
  30591. return false;
  30592. }
  30593. }
  30594. return true;
  30595. };
  30596. //
  30597. // Returns the unique alternative predicted by all alternative subsets in
  30598. // {@code altsets}. If no such alternative exists, this method returns
  30599. // {@link ATN//INVALID_ALT_NUMBER}.
  30600. //
  30601. // @param altsets a collection of alternative subsets
  30602. //
  30603. PredictionMode.getUniqueAlt = function (altsets) {
  30604. var all = PredictionMode.getAlts(altsets);
  30605. if (all.length === 1) {
  30606. return all.minValue();
  30607. } else {
  30608. return ATN.INVALID_ALT_NUMBER;
  30609. }
  30610. };
  30611. // Gets the complete set of represented alternatives for a collection of
  30612. // alternative subsets. This method returns the union of each {@link BitSet}
  30613. // in {@code altsets}.
  30614. //
  30615. // @param altsets a collection of alternative subsets
  30616. // @return the set of represented alternatives in {@code altsets}
  30617. //
  30618. PredictionMode.getAlts = function (altsets) {
  30619. var all = new BitSet();
  30620. altsets.map(function (alts) {
  30621. all.or(alts);
  30622. });
  30623. return all;
  30624. };
  30625. //
  30626. // This function gets the conflicting alt subsets from a configuration set.
  30627. // For each configuration {@code c} in {@code configs}:
  30628. //
  30629. // <pre>
  30630. // map[c] U= c.{@link ATNConfig//alt alt} // map hash/equals uses s and x, not
  30631. // alt and not pred
  30632. // </pre>
  30633. PredictionMode.getConflictingAltSubsets = function (configs) {
  30634. var configToAlts = new Map();
  30635. configToAlts.hashFunction = function (cfg) {
  30636. hashStuff(cfg.state.stateNumber, cfg.context);
  30637. };
  30638. configToAlts.equalsFunction = function (c1, c2) {
  30639. return c1.state.stateNumber == c2.state.stateNumber && c1.context.equals(c2.context);
  30640. };
  30641. configs.items.map(function (cfg) {
  30642. var alts = configToAlts.get(cfg);
  30643. if (alts === null) {
  30644. alts = new BitSet();
  30645. configToAlts.put(cfg, alts);
  30646. }
  30647. alts.add(cfg.alt);
  30648. });
  30649. return configToAlts.getValues();
  30650. };
  30651. //
  30652. // Get a map from state to alt subset from a configuration set. For each
  30653. // configuration {@code c} in {@code configs}:
  30654. //
  30655. // <pre>
  30656. // map[c.{@link ATNConfig//state state}] U= c.{@link ATNConfig//alt alt}
  30657. // </pre>
  30658. //
  30659. PredictionMode.getStateToAltMap = function (configs) {
  30660. var m = new AltDict();
  30661. configs.items.map(function (c) {
  30662. var alts = m.get(c.state);
  30663. if (alts === null) {
  30664. alts = new BitSet();
  30665. m.put(c.state, alts);
  30666. }
  30667. alts.add(c.alt);
  30668. });
  30669. return m;
  30670. };
  30671. PredictionMode.hasStateAssociatedWithOneAlt = function (configs) {
  30672. var values = PredictionMode.getStateToAltMap(configs).values();
  30673. for (var i = 0; i < values.length; i++) {
  30674. if (values[i].length === 1) {
  30675. return true;
  30676. }
  30677. }
  30678. return false;
  30679. };
  30680. PredictionMode.getSingleViableAlt = function (altsets) {
  30681. var result = null;
  30682. for (var i = 0; i < altsets.length; i++) {
  30683. var alts = altsets[i];
  30684. var minAlt = alts.minValue();
  30685. if (result === null) {
  30686. result = minAlt;
  30687. } else if (result !== minAlt) {
  30688. // more than 1 viable alt
  30689. return ATN.INVALID_ALT_NUMBER;
  30690. }
  30691. }
  30692. return result;
  30693. };
  30694. exports.PredictionMode = PredictionMode;
  30695. /***/ }),
  30696. /***/ "./node_modules/antlr4/atn/SemanticContext.js":
  30697. /*!****************************************************!*\
  30698. !*** ./node_modules/antlr4/atn/SemanticContext.js ***!
  30699. \****************************************************/
  30700. /*! no static exports found */
  30701. /***/ (function(module, exports, __webpack_require__) {
  30702. "use strict";
  30703. //
  30704. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  30705. * Use of this file is governed by the BSD 3-clause license that
  30706. * can be found in the LICENSE.txt file in the project root.
  30707. */
  30708. //
  30709. // A tree structure used to record the semantic context in which
  30710. // an ATN configuration is valid. It's either a single predicate,
  30711. // a conjunction {@code p1&&p2}, or a sum of products {@code p1||p2}.
  30712. //
  30713. // <p>I have scoped the {@link AND}, {@link OR}, and {@link Predicate} subclasses of
  30714. // {@link SemanticContext} within the scope of this outer class.</p>
  30715. //
  30716. var Set = __webpack_require__(/*! ./../Utils */ "./node_modules/antlr4/Utils.js").Set;
  30717. var Hash = __webpack_require__(/*! ./../Utils */ "./node_modules/antlr4/Utils.js").Hash;
  30718. function SemanticContext() {
  30719. return this;
  30720. }
  30721. SemanticContext.prototype.hashCode = function () {
  30722. var hash = new Hash();
  30723. this.updateHashCode(hash);
  30724. return hash.finish();
  30725. };
  30726. // For context independent predicates, we evaluate them without a local
  30727. // context (i.e., null context). That way, we can evaluate them without
  30728. // having to create proper rule-specific context during prediction (as
  30729. // opposed to the parser, which creates them naturally). In a practical
  30730. // sense, this avoids a cast exception from RuleContext to myruleContext.
  30731. //
  30732. // <p>For context dependent predicates, we must pass in a local context so that
  30733. // references such as $arg evaluate properly as _localctx.arg. We only
  30734. // capture context dependent predicates in the context in which we begin
  30735. // prediction, so we passed in the outer context here in case of context
  30736. // dependent predicate evaluation.</p>
  30737. //
  30738. SemanticContext.prototype.evaluate = function (parser, outerContext) {};
  30739. //
  30740. // Evaluate the precedence predicates for the context and reduce the result.
  30741. //
  30742. // @param parser The parser instance.
  30743. // @param outerContext The current parser context object.
  30744. // @return The simplified semantic context after precedence predicates are
  30745. // evaluated, which will be one of the following values.
  30746. // <ul>
  30747. // <li>{@link //NONE}: if the predicate simplifies to {@code true} after
  30748. // precedence predicates are evaluated.</li>
  30749. // <li>{@code null}: if the predicate simplifies to {@code false} after
  30750. // precedence predicates are evaluated.</li>
  30751. // <li>{@code this}: if the semantic context is not changed as a result of
  30752. // precedence predicate evaluation.</li>
  30753. // <li>A non-{@code null} {@link SemanticContext}: the new simplified
  30754. // semantic context after precedence predicates are evaluated.</li>
  30755. // </ul>
  30756. //
  30757. SemanticContext.prototype.evalPrecedence = function (parser, outerContext) {
  30758. return this;
  30759. };
  30760. SemanticContext.andContext = function (a, b) {
  30761. if (a === null || a === SemanticContext.NONE) {
  30762. return b;
  30763. }
  30764. if (b === null || b === SemanticContext.NONE) {
  30765. return a;
  30766. }
  30767. var result = new AND(a, b);
  30768. if (result.opnds.length === 1) {
  30769. return result.opnds[0];
  30770. } else {
  30771. return result;
  30772. }
  30773. };
  30774. SemanticContext.orContext = function (a, b) {
  30775. if (a === null) {
  30776. return b;
  30777. }
  30778. if (b === null) {
  30779. return a;
  30780. }
  30781. if (a === SemanticContext.NONE || b === SemanticContext.NONE) {
  30782. return SemanticContext.NONE;
  30783. }
  30784. var result = new OR(a, b);
  30785. if (result.opnds.length === 1) {
  30786. return result.opnds[0];
  30787. } else {
  30788. return result;
  30789. }
  30790. };
  30791. function Predicate(ruleIndex, predIndex, isCtxDependent) {
  30792. SemanticContext.call(this);
  30793. this.ruleIndex = ruleIndex === undefined ? -1 : ruleIndex;
  30794. this.predIndex = predIndex === undefined ? -1 : predIndex;
  30795. this.isCtxDependent = isCtxDependent === undefined ? false : isCtxDependent; // e.g., $i ref in pred
  30796. return this;
  30797. }
  30798. Predicate.prototype = Object.create(SemanticContext.prototype);
  30799. Predicate.prototype.constructor = Predicate;
  30800. //The default {@link SemanticContext}, which is semantically equivalent to
  30801. //a predicate of the form {@code {true}?}.
  30802. //
  30803. SemanticContext.NONE = new Predicate();
  30804. Predicate.prototype.evaluate = function (parser, outerContext) {
  30805. var localctx = this.isCtxDependent ? outerContext : null;
  30806. return parser.sempred(localctx, this.ruleIndex, this.predIndex);
  30807. };
  30808. Predicate.prototype.updateHashCode = function (hash) {
  30809. hash.update(this.ruleIndex, this.predIndex, this.isCtxDependent);
  30810. };
  30811. Predicate.prototype.equals = function (other) {
  30812. if (this === other) {
  30813. return true;
  30814. } else if (!(other instanceof Predicate)) {
  30815. return false;
  30816. } else {
  30817. return this.ruleIndex === other.ruleIndex && this.predIndex === other.predIndex && this.isCtxDependent === other.isCtxDependent;
  30818. }
  30819. };
  30820. Predicate.prototype.toString = function () {
  30821. return "{" + this.ruleIndex + ":" + this.predIndex + "}?";
  30822. };
  30823. function PrecedencePredicate(precedence) {
  30824. SemanticContext.call(this);
  30825. this.precedence = precedence === undefined ? 0 : precedence;
  30826. }
  30827. PrecedencePredicate.prototype = Object.create(SemanticContext.prototype);
  30828. PrecedencePredicate.prototype.constructor = PrecedencePredicate;
  30829. PrecedencePredicate.prototype.evaluate = function (parser, outerContext) {
  30830. return parser.precpred(outerContext, this.precedence);
  30831. };
  30832. PrecedencePredicate.prototype.evalPrecedence = function (parser, outerContext) {
  30833. if (parser.precpred(outerContext, this.precedence)) {
  30834. return SemanticContext.NONE;
  30835. } else {
  30836. return null;
  30837. }
  30838. };
  30839. PrecedencePredicate.prototype.compareTo = function (other) {
  30840. return this.precedence - other.precedence;
  30841. };
  30842. PrecedencePredicate.prototype.updateHashCode = function (hash) {
  30843. hash.update(31);
  30844. };
  30845. PrecedencePredicate.prototype.equals = function (other) {
  30846. if (this === other) {
  30847. return true;
  30848. } else if (!(other instanceof PrecedencePredicate)) {
  30849. return false;
  30850. } else {
  30851. return this.precedence === other.precedence;
  30852. }
  30853. };
  30854. PrecedencePredicate.prototype.toString = function () {
  30855. return "{" + this.precedence + ">=prec}?";
  30856. };
  30857. PrecedencePredicate.filterPrecedencePredicates = function (set) {
  30858. var result = [];
  30859. set.values().map(function (context) {
  30860. if (context instanceof PrecedencePredicate) {
  30861. result.push(context);
  30862. }
  30863. });
  30864. return result;
  30865. };
  30866. // A semantic context which is true whenever none of the contained contexts
  30867. // is false.
  30868. //
  30869. function AND(a, b) {
  30870. SemanticContext.call(this);
  30871. var operands = new Set();
  30872. if (a instanceof AND) {
  30873. a.opnds.map(function (o) {
  30874. operands.add(o);
  30875. });
  30876. } else {
  30877. operands.add(a);
  30878. }
  30879. if (b instanceof AND) {
  30880. b.opnds.map(function (o) {
  30881. operands.add(o);
  30882. });
  30883. } else {
  30884. operands.add(b);
  30885. }
  30886. var precedencePredicates = PrecedencePredicate.filterPrecedencePredicates(operands);
  30887. if (precedencePredicates.length > 0) {
  30888. // interested in the transition with the lowest precedence
  30889. var reduced = null;
  30890. precedencePredicates.map(function (p) {
  30891. if (reduced === null || p.precedence < reduced.precedence) {
  30892. reduced = p;
  30893. }
  30894. });
  30895. operands.add(reduced);
  30896. }
  30897. this.opnds = operands.values();
  30898. return this;
  30899. }
  30900. AND.prototype = Object.create(SemanticContext.prototype);
  30901. AND.prototype.constructor = AND;
  30902. AND.prototype.equals = function (other) {
  30903. if (this === other) {
  30904. return true;
  30905. } else if (!(other instanceof AND)) {
  30906. return false;
  30907. } else {
  30908. return this.opnds === other.opnds;
  30909. }
  30910. };
  30911. AND.prototype.updateHashCode = function (hash) {
  30912. hash.update(this.opnds, "AND");
  30913. };
  30914. //
  30915. // {@inheritDoc}
  30916. //
  30917. // <p>
  30918. // The evaluation of predicates by this context is short-circuiting, but
  30919. // unordered.</p>
  30920. //
  30921. AND.prototype.evaluate = function (parser, outerContext) {
  30922. for (var i = 0; i < this.opnds.length; i++) {
  30923. if (!this.opnds[i].evaluate(parser, outerContext)) {
  30924. return false;
  30925. }
  30926. }
  30927. return true;
  30928. };
  30929. AND.prototype.evalPrecedence = function (parser, outerContext) {
  30930. var differs = false;
  30931. var operands = [];
  30932. for (var i = 0; i < this.opnds.length; i++) {
  30933. var context = this.opnds[i];
  30934. var evaluated = context.evalPrecedence(parser, outerContext);
  30935. differs |= evaluated !== context;
  30936. if (evaluated === null) {
  30937. // The AND context is false if any element is false
  30938. return null;
  30939. } else if (evaluated !== SemanticContext.NONE) {
  30940. // Reduce the result by skipping true elements
  30941. operands.push(evaluated);
  30942. }
  30943. }
  30944. if (!differs) {
  30945. return this;
  30946. }
  30947. if (operands.length === 0) {
  30948. // all elements were true, so the AND context is true
  30949. return SemanticContext.NONE;
  30950. }
  30951. var result = null;
  30952. operands.map(function (o) {
  30953. result = result === null ? o : SemanticContext.andContext(result, o);
  30954. });
  30955. return result;
  30956. };
  30957. AND.prototype.toString = function () {
  30958. var s = "";
  30959. this.opnds.map(function (o) {
  30960. s += "&& " + o.toString();
  30961. });
  30962. return s.length > 3 ? s.slice(3) : s;
  30963. };
  30964. //
  30965. // A semantic context which is true whenever at least one of the contained
  30966. // contexts is true.
  30967. //
  30968. function OR(a, b) {
  30969. SemanticContext.call(this);
  30970. var operands = new Set();
  30971. if (a instanceof OR) {
  30972. a.opnds.map(function (o) {
  30973. operands.add(o);
  30974. });
  30975. } else {
  30976. operands.add(a);
  30977. }
  30978. if (b instanceof OR) {
  30979. b.opnds.map(function (o) {
  30980. operands.add(o);
  30981. });
  30982. } else {
  30983. operands.add(b);
  30984. }
  30985. var precedencePredicates = PrecedencePredicate.filterPrecedencePredicates(operands);
  30986. if (precedencePredicates.length > 0) {
  30987. // interested in the transition with the highest precedence
  30988. var s = precedencePredicates.sort(function (a, b) {
  30989. return a.compareTo(b);
  30990. });
  30991. var reduced = s[s.length - 1];
  30992. operands.add(reduced);
  30993. }
  30994. this.opnds = operands.values();
  30995. return this;
  30996. }
  30997. OR.prototype = Object.create(SemanticContext.prototype);
  30998. OR.prototype.constructor = OR;
  30999. OR.prototype.constructor = function (other) {
  31000. if (this === other) {
  31001. return true;
  31002. } else if (!(other instanceof OR)) {
  31003. return false;
  31004. } else {
  31005. return this.opnds === other.opnds;
  31006. }
  31007. };
  31008. OR.prototype.updateHashCode = function (hash) {
  31009. hash.update(this.opnds, "OR");
  31010. };
  31011. // <p>
  31012. // The evaluation of predicates by this context is short-circuiting, but
  31013. // unordered.</p>
  31014. //
  31015. OR.prototype.evaluate = function (parser, outerContext) {
  31016. for (var i = 0; i < this.opnds.length; i++) {
  31017. if (this.opnds[i].evaluate(parser, outerContext)) {
  31018. return true;
  31019. }
  31020. }
  31021. return false;
  31022. };
  31023. OR.prototype.evalPrecedence = function (parser, outerContext) {
  31024. var differs = false;
  31025. var operands = [];
  31026. for (var i = 0; i < this.opnds.length; i++) {
  31027. var context = this.opnds[i];
  31028. var evaluated = context.evalPrecedence(parser, outerContext);
  31029. differs |= evaluated !== context;
  31030. if (evaluated === SemanticContext.NONE) {
  31031. // The OR context is true if any element is true
  31032. return SemanticContext.NONE;
  31033. } else if (evaluated !== null) {
  31034. // Reduce the result by skipping false elements
  31035. operands.push(evaluated);
  31036. }
  31037. }
  31038. if (!differs) {
  31039. return this;
  31040. }
  31041. if (operands.length === 0) {
  31042. // all elements were false, so the OR context is false
  31043. return null;
  31044. }
  31045. var result = null;
  31046. operands.map(function (o) {
  31047. return result === null ? o : SemanticContext.orContext(result, o);
  31048. });
  31049. return result;
  31050. };
  31051. OR.prototype.toString = function () {
  31052. var s = "";
  31053. this.opnds.map(function (o) {
  31054. s += "|| " + o.toString();
  31055. });
  31056. return s.length > 3 ? s.slice(3) : s;
  31057. };
  31058. exports.SemanticContext = SemanticContext;
  31059. exports.PrecedencePredicate = PrecedencePredicate;
  31060. exports.Predicate = Predicate;
  31061. /***/ }),
  31062. /***/ "./node_modules/antlr4/atn/Transition.js":
  31063. /*!***********************************************!*\
  31064. !*** ./node_modules/antlr4/atn/Transition.js ***!
  31065. \***********************************************/
  31066. /*! no static exports found */
  31067. /***/ (function(module, exports, __webpack_require__) {
  31068. "use strict";
  31069. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  31070. * Use of this file is governed by the BSD 3-clause license that
  31071. * can be found in the LICENSE.txt file in the project root.
  31072. */
  31073. //
  31074. // An ATN transition between any two ATN states. Subclasses define
  31075. // atom, set, epsilon, action, predicate, rule transitions.
  31076. //
  31077. // <p>This is a one way link. It emanates from a state (usually via a list of
  31078. // transitions) and has a target state.</p>
  31079. //
  31080. // <p>Since we never have to change the ATN transitions once we construct it,
  31081. // we can fix these transitions as specific classes. The DFA transitions
  31082. // on the other hand need to update the labels as it adds transitions to
  31083. // the states. We'll use the term Edge for the DFA to distinguish them from
  31084. // ATN transitions.</p>
  31085. var Token = __webpack_require__(/*! ./../Token */ "./node_modules/antlr4/Token.js").Token;
  31086. var Interval = __webpack_require__(/*! ./../IntervalSet */ "./node_modules/antlr4/IntervalSet.js").Interval;
  31087. var IntervalSet = __webpack_require__(/*! ./../IntervalSet */ "./node_modules/antlr4/IntervalSet.js").IntervalSet;
  31088. var Predicate = __webpack_require__(/*! ./SemanticContext */ "./node_modules/antlr4/atn/SemanticContext.js").Predicate;
  31089. var PrecedencePredicate = __webpack_require__(/*! ./SemanticContext */ "./node_modules/antlr4/atn/SemanticContext.js").PrecedencePredicate;
  31090. function Transition(target) {
  31091. // The target of this transition.
  31092. if (target === undefined || target === null) {
  31093. throw "target cannot be null.";
  31094. }
  31095. this.target = target;
  31096. // Are we epsilon, action, sempred?
  31097. this.isEpsilon = false;
  31098. this.label = null;
  31099. return this;
  31100. }
  31101. // constants for serialization
  31102. Transition.EPSILON = 1;
  31103. Transition.RANGE = 2;
  31104. Transition.RULE = 3;
  31105. Transition.PREDICATE = 4; // e.g., {isType(input.LT(1))}?
  31106. Transition.ATOM = 5;
  31107. Transition.ACTION = 6;
  31108. Transition.SET = 7; // ~(A|B) or ~atom, wildcard, which convert to next 2
  31109. Transition.NOT_SET = 8;
  31110. Transition.WILDCARD = 9;
  31111. Transition.PRECEDENCE = 10;
  31112. Transition.serializationNames = ["INVALID", "EPSILON", "RANGE", "RULE", "PREDICATE", "ATOM", "ACTION", "SET", "NOT_SET", "WILDCARD", "PRECEDENCE"];
  31113. Transition.serializationTypes = {
  31114. EpsilonTransition: Transition.EPSILON,
  31115. RangeTransition: Transition.RANGE,
  31116. RuleTransition: Transition.RULE,
  31117. PredicateTransition: Transition.PREDICATE,
  31118. AtomTransition: Transition.ATOM,
  31119. ActionTransition: Transition.ACTION,
  31120. SetTransition: Transition.SET,
  31121. NotSetTransition: Transition.NOT_SET,
  31122. WildcardTransition: Transition.WILDCARD,
  31123. PrecedencePredicateTransition: Transition.PRECEDENCE
  31124. };
  31125. // TODO: make all transitions sets? no, should remove set edges
  31126. function AtomTransition(target, label) {
  31127. Transition.call(this, target);
  31128. this.label_ = label; // The token type or character value; or, signifies special label.
  31129. this.label = this.makeLabel();
  31130. this.serializationType = Transition.ATOM;
  31131. return this;
  31132. }
  31133. AtomTransition.prototype = Object.create(Transition.prototype);
  31134. AtomTransition.prototype.constructor = AtomTransition;
  31135. AtomTransition.prototype.makeLabel = function () {
  31136. var s = new IntervalSet();
  31137. s.addOne(this.label_);
  31138. return s;
  31139. };
  31140. AtomTransition.prototype.matches = function (symbol, minVocabSymbol, maxVocabSymbol) {
  31141. return this.label_ === symbol;
  31142. };
  31143. AtomTransition.prototype.toString = function () {
  31144. return this.label_;
  31145. };
  31146. function RuleTransition(ruleStart, ruleIndex, precedence, followState) {
  31147. Transition.call(this, ruleStart);
  31148. this.ruleIndex = ruleIndex; // ptr to the rule definition object for this rule ref
  31149. this.precedence = precedence;
  31150. this.followState = followState; // what node to begin computations following ref to rule
  31151. this.serializationType = Transition.RULE;
  31152. this.isEpsilon = true;
  31153. return this;
  31154. }
  31155. RuleTransition.prototype = Object.create(Transition.prototype);
  31156. RuleTransition.prototype.constructor = RuleTransition;
  31157. RuleTransition.prototype.matches = function (symbol, minVocabSymbol, maxVocabSymbol) {
  31158. return false;
  31159. };
  31160. function EpsilonTransition(target, outermostPrecedenceReturn) {
  31161. Transition.call(this, target);
  31162. this.serializationType = Transition.EPSILON;
  31163. this.isEpsilon = true;
  31164. this.outermostPrecedenceReturn = outermostPrecedenceReturn;
  31165. return this;
  31166. }
  31167. EpsilonTransition.prototype = Object.create(Transition.prototype);
  31168. EpsilonTransition.prototype.constructor = EpsilonTransition;
  31169. EpsilonTransition.prototype.matches = function (symbol, minVocabSymbol, maxVocabSymbol) {
  31170. return false;
  31171. };
  31172. EpsilonTransition.prototype.toString = function () {
  31173. return "epsilon";
  31174. };
  31175. function RangeTransition(target, start, stop) {
  31176. Transition.call(this, target);
  31177. this.serializationType = Transition.RANGE;
  31178. this.start = start;
  31179. this.stop = stop;
  31180. this.label = this.makeLabel();
  31181. return this;
  31182. }
  31183. RangeTransition.prototype = Object.create(Transition.prototype);
  31184. RangeTransition.prototype.constructor = RangeTransition;
  31185. RangeTransition.prototype.makeLabel = function () {
  31186. var s = new IntervalSet();
  31187. s.addRange(this.start, this.stop);
  31188. return s;
  31189. };
  31190. RangeTransition.prototype.matches = function (symbol, minVocabSymbol, maxVocabSymbol) {
  31191. return symbol >= this.start && symbol <= this.stop;
  31192. };
  31193. RangeTransition.prototype.toString = function () {
  31194. return "'" + String.fromCharCode(this.start) + "'..'" + String.fromCharCode(this.stop) + "'";
  31195. };
  31196. function AbstractPredicateTransition(target) {
  31197. Transition.call(this, target);
  31198. return this;
  31199. }
  31200. AbstractPredicateTransition.prototype = Object.create(Transition.prototype);
  31201. AbstractPredicateTransition.prototype.constructor = AbstractPredicateTransition;
  31202. function PredicateTransition(target, ruleIndex, predIndex, isCtxDependent) {
  31203. AbstractPredicateTransition.call(this, target);
  31204. this.serializationType = Transition.PREDICATE;
  31205. this.ruleIndex = ruleIndex;
  31206. this.predIndex = predIndex;
  31207. this.isCtxDependent = isCtxDependent; // e.g., $i ref in pred
  31208. this.isEpsilon = true;
  31209. return this;
  31210. }
  31211. PredicateTransition.prototype = Object.create(AbstractPredicateTransition.prototype);
  31212. PredicateTransition.prototype.constructor = PredicateTransition;
  31213. PredicateTransition.prototype.matches = function (symbol, minVocabSymbol, maxVocabSymbol) {
  31214. return false;
  31215. };
  31216. PredicateTransition.prototype.getPredicate = function () {
  31217. return new Predicate(this.ruleIndex, this.predIndex, this.isCtxDependent);
  31218. };
  31219. PredicateTransition.prototype.toString = function () {
  31220. return "pred_" + this.ruleIndex + ":" + this.predIndex;
  31221. };
  31222. function ActionTransition(target, ruleIndex, actionIndex, isCtxDependent) {
  31223. Transition.call(this, target);
  31224. this.serializationType = Transition.ACTION;
  31225. this.ruleIndex = ruleIndex;
  31226. this.actionIndex = actionIndex === undefined ? -1 : actionIndex;
  31227. this.isCtxDependent = isCtxDependent === undefined ? false : isCtxDependent; // e.g., $i ref in pred
  31228. this.isEpsilon = true;
  31229. return this;
  31230. }
  31231. ActionTransition.prototype = Object.create(Transition.prototype);
  31232. ActionTransition.prototype.constructor = ActionTransition;
  31233. ActionTransition.prototype.matches = function (symbol, minVocabSymbol, maxVocabSymbol) {
  31234. return false;
  31235. };
  31236. ActionTransition.prototype.toString = function () {
  31237. return "action_" + this.ruleIndex + ":" + this.actionIndex;
  31238. };
  31239. // A transition containing a set of values.
  31240. function SetTransition(target, set) {
  31241. Transition.call(this, target);
  31242. this.serializationType = Transition.SET;
  31243. if (set !== undefined && set !== null) {
  31244. this.label = set;
  31245. } else {
  31246. this.label = new IntervalSet();
  31247. this.label.addOne(Token.INVALID_TYPE);
  31248. }
  31249. return this;
  31250. }
  31251. SetTransition.prototype = Object.create(Transition.prototype);
  31252. SetTransition.prototype.constructor = SetTransition;
  31253. SetTransition.prototype.matches = function (symbol, minVocabSymbol, maxVocabSymbol) {
  31254. return this.label.contains(symbol);
  31255. };
  31256. SetTransition.prototype.toString = function () {
  31257. return this.label.toString();
  31258. };
  31259. function NotSetTransition(target, set) {
  31260. SetTransition.call(this, target, set);
  31261. this.serializationType = Transition.NOT_SET;
  31262. return this;
  31263. }
  31264. NotSetTransition.prototype = Object.create(SetTransition.prototype);
  31265. NotSetTransition.prototype.constructor = NotSetTransition;
  31266. NotSetTransition.prototype.matches = function (symbol, minVocabSymbol, maxVocabSymbol) {
  31267. return symbol >= minVocabSymbol && symbol <= maxVocabSymbol && !SetTransition.prototype.matches.call(this, symbol, minVocabSymbol, maxVocabSymbol);
  31268. };
  31269. NotSetTransition.prototype.toString = function () {
  31270. return '~' + SetTransition.prototype.toString.call(this);
  31271. };
  31272. function WildcardTransition(target) {
  31273. Transition.call(this, target);
  31274. this.serializationType = Transition.WILDCARD;
  31275. return this;
  31276. }
  31277. WildcardTransition.prototype = Object.create(Transition.prototype);
  31278. WildcardTransition.prototype.constructor = WildcardTransition;
  31279. WildcardTransition.prototype.matches = function (symbol, minVocabSymbol, maxVocabSymbol) {
  31280. return symbol >= minVocabSymbol && symbol <= maxVocabSymbol;
  31281. };
  31282. WildcardTransition.prototype.toString = function () {
  31283. return ".";
  31284. };
  31285. function PrecedencePredicateTransition(target, precedence) {
  31286. AbstractPredicateTransition.call(this, target);
  31287. this.serializationType = Transition.PRECEDENCE;
  31288. this.precedence = precedence;
  31289. this.isEpsilon = true;
  31290. return this;
  31291. }
  31292. PrecedencePredicateTransition.prototype = Object.create(AbstractPredicateTransition.prototype);
  31293. PrecedencePredicateTransition.prototype.constructor = PrecedencePredicateTransition;
  31294. PrecedencePredicateTransition.prototype.matches = function (symbol, minVocabSymbol, maxVocabSymbol) {
  31295. return false;
  31296. };
  31297. PrecedencePredicateTransition.prototype.getPredicate = function () {
  31298. return new PrecedencePredicate(this.precedence);
  31299. };
  31300. PrecedencePredicateTransition.prototype.toString = function () {
  31301. return this.precedence + " >= _p";
  31302. };
  31303. exports.Transition = Transition;
  31304. exports.AtomTransition = AtomTransition;
  31305. exports.SetTransition = SetTransition;
  31306. exports.NotSetTransition = NotSetTransition;
  31307. exports.RuleTransition = RuleTransition;
  31308. exports.ActionTransition = ActionTransition;
  31309. exports.EpsilonTransition = EpsilonTransition;
  31310. exports.RangeTransition = RangeTransition;
  31311. exports.WildcardTransition = WildcardTransition;
  31312. exports.PredicateTransition = PredicateTransition;
  31313. exports.PrecedencePredicateTransition = PrecedencePredicateTransition;
  31314. exports.AbstractPredicateTransition = AbstractPredicateTransition;
  31315. /***/ }),
  31316. /***/ "./node_modules/antlr4/atn/index.js":
  31317. /*!******************************************!*\
  31318. !*** ./node_modules/antlr4/atn/index.js ***!
  31319. \******************************************/
  31320. /*! no static exports found */
  31321. /***/ (function(module, exports, __webpack_require__) {
  31322. "use strict";
  31323. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  31324. * Use of this file is governed by the BSD 3-clause license that
  31325. * can be found in the LICENSE.txt file in the project root.
  31326. */
  31327. exports.ATN = __webpack_require__(/*! ./ATN */ "./node_modules/antlr4/atn/ATN.js").ATN;
  31328. exports.ATNDeserializer = __webpack_require__(/*! ./ATNDeserializer */ "./node_modules/antlr4/atn/ATNDeserializer.js").ATNDeserializer;
  31329. exports.LexerATNSimulator = __webpack_require__(/*! ./LexerATNSimulator */ "./node_modules/antlr4/atn/LexerATNSimulator.js").LexerATNSimulator;
  31330. exports.ParserATNSimulator = __webpack_require__(/*! ./ParserATNSimulator */ "./node_modules/antlr4/atn/ParserATNSimulator.js").ParserATNSimulator;
  31331. exports.PredictionMode = __webpack_require__(/*! ./PredictionMode */ "./node_modules/antlr4/atn/PredictionMode.js").PredictionMode;
  31332. /***/ }),
  31333. /***/ "./node_modules/antlr4/dfa/DFA.js":
  31334. /*!****************************************!*\
  31335. !*** ./node_modules/antlr4/dfa/DFA.js ***!
  31336. \****************************************/
  31337. /*! no static exports found */
  31338. /***/ (function(module, exports, __webpack_require__) {
  31339. "use strict";
  31340. //
  31341. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  31342. * Use of this file is governed by the BSD 3-clause license that
  31343. * can be found in the LICENSE.txt file in the project root.
  31344. */
  31345. var Set = __webpack_require__(/*! ../Utils */ "./node_modules/antlr4/Utils.js").Set;
  31346. var DFAState = __webpack_require__(/*! ./DFAState */ "./node_modules/antlr4/dfa/DFAState.js").DFAState;
  31347. var StarLoopEntryState = __webpack_require__(/*! ../atn/ATNState */ "./node_modules/antlr4/atn/ATNState.js").StarLoopEntryState;
  31348. var ATNConfigSet = __webpack_require__(/*! ./../atn/ATNConfigSet */ "./node_modules/antlr4/atn/ATNConfigSet.js").ATNConfigSet;
  31349. var DFASerializer = __webpack_require__(/*! ./DFASerializer */ "./node_modules/antlr4/dfa/DFASerializer.js").DFASerializer;
  31350. var LexerDFASerializer = __webpack_require__(/*! ./DFASerializer */ "./node_modules/antlr4/dfa/DFASerializer.js").LexerDFASerializer;
  31351. function DFA(atnStartState, decision) {
  31352. if (decision === undefined) {
  31353. decision = 0;
  31354. }
  31355. // From which ATN state did we create this DFA?
  31356. this.atnStartState = atnStartState;
  31357. this.decision = decision;
  31358. // A set of all DFA states. Use {@link Map} so we can get old state back
  31359. // ({@link Set} only allows you to see if it's there).
  31360. this._states = new Set();
  31361. this.s0 = null;
  31362. // {@code true} if this DFA is for a precedence decision; otherwise,
  31363. // {@code false}. This is the backing field for {@link //isPrecedenceDfa},
  31364. // {@link //setPrecedenceDfa}.
  31365. this.precedenceDfa = false;
  31366. if (atnStartState instanceof StarLoopEntryState) {
  31367. if (atnStartState.isPrecedenceDecision) {
  31368. this.precedenceDfa = true;
  31369. var precedenceState = new DFAState(null, new ATNConfigSet());
  31370. precedenceState.edges = [];
  31371. precedenceState.isAcceptState = false;
  31372. precedenceState.requiresFullContext = false;
  31373. this.s0 = precedenceState;
  31374. }
  31375. }
  31376. return this;
  31377. }
  31378. // Get the start state for a specific precedence value.
  31379. //
  31380. // @param precedence The current precedence.
  31381. // @return The start state corresponding to the specified precedence, or
  31382. // {@code null} if no start state exists for the specified precedence.
  31383. //
  31384. // @throws IllegalStateException if this is not a precedence DFA.
  31385. // @see //isPrecedenceDfa()
  31386. DFA.prototype.getPrecedenceStartState = function (precedence) {
  31387. if (!this.precedenceDfa) {
  31388. throw "Only precedence DFAs may contain a precedence start state.";
  31389. }
  31390. // s0.edges is never null for a precedence DFA
  31391. if (precedence < 0 || precedence >= this.s0.edges.length) {
  31392. return null;
  31393. }
  31394. return this.s0.edges[precedence] || null;
  31395. };
  31396. // Set the start state for a specific precedence value.
  31397. //
  31398. // @param precedence The current precedence.
  31399. // @param startState The start state corresponding to the specified
  31400. // precedence.
  31401. //
  31402. // @throws IllegalStateException if this is not a precedence DFA.
  31403. // @see //isPrecedenceDfa()
  31404. //
  31405. DFA.prototype.setPrecedenceStartState = function (precedence, startState) {
  31406. if (!this.precedenceDfa) {
  31407. throw "Only precedence DFAs may contain a precedence start state.";
  31408. }
  31409. if (precedence < 0) {
  31410. return;
  31411. }
  31412. // synchronization on s0 here is ok. when the DFA is turned into a
  31413. // precedence DFA, s0 will be initialized once and not updated again
  31414. // s0.edges is never null for a precedence DFA
  31415. this.s0.edges[precedence] = startState;
  31416. };
  31417. //
  31418. // Sets whether this is a precedence DFA. If the specified value differs
  31419. // from the current DFA configuration, the following actions are taken;
  31420. // otherwise no changes are made to the current DFA.
  31421. //
  31422. // <ul>
  31423. // <li>The {@link //states} map is cleared</li>
  31424. // <li>If {@code precedenceDfa} is {@code false}, the initial state
  31425. // {@link //s0} is set to {@code null}; otherwise, it is initialized to a new
  31426. // {@link DFAState} with an empty outgoing {@link DFAState//edges} array to
  31427. // store the start states for individual precedence values.</li>
  31428. // <li>The {@link //precedenceDfa} field is updated</li>
  31429. // </ul>
  31430. //
  31431. // @param precedenceDfa {@code true} if this is a precedence DFA; otherwise,
  31432. // {@code false}
  31433. DFA.prototype.setPrecedenceDfa = function (precedenceDfa) {
  31434. if (this.precedenceDfa !== precedenceDfa) {
  31435. this._states = new DFAStatesSet();
  31436. if (precedenceDfa) {
  31437. var precedenceState = new DFAState(null, new ATNConfigSet());
  31438. precedenceState.edges = [];
  31439. precedenceState.isAcceptState = false;
  31440. precedenceState.requiresFullContext = false;
  31441. this.s0 = precedenceState;
  31442. } else {
  31443. this.s0 = null;
  31444. }
  31445. this.precedenceDfa = precedenceDfa;
  31446. }
  31447. };
  31448. Object.defineProperty(DFA.prototype, "states", {
  31449. get: function get() {
  31450. return this._states;
  31451. }
  31452. });
  31453. // Return a list of all states in this DFA, ordered by state number.
  31454. DFA.prototype.sortedStates = function () {
  31455. var list = this._states.values();
  31456. return list.sort(function (a, b) {
  31457. return a.stateNumber - b.stateNumber;
  31458. });
  31459. };
  31460. DFA.prototype.toString = function (literalNames, symbolicNames) {
  31461. literalNames = literalNames || null;
  31462. symbolicNames = symbolicNames || null;
  31463. if (this.s0 === null) {
  31464. return "";
  31465. }
  31466. var serializer = new DFASerializer(this, literalNames, symbolicNames);
  31467. return serializer.toString();
  31468. };
  31469. DFA.prototype.toLexerString = function () {
  31470. if (this.s0 === null) {
  31471. return "";
  31472. }
  31473. var serializer = new LexerDFASerializer(this);
  31474. return serializer.toString();
  31475. };
  31476. exports.DFA = DFA;
  31477. /***/ }),
  31478. /***/ "./node_modules/antlr4/dfa/DFASerializer.js":
  31479. /*!**************************************************!*\
  31480. !*** ./node_modules/antlr4/dfa/DFASerializer.js ***!
  31481. \**************************************************/
  31482. /*! no static exports found */
  31483. /***/ (function(module, exports, __webpack_require__) {
  31484. "use strict";
  31485. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  31486. * Use of this file is governed by the BSD 3-clause license that
  31487. * can be found in the LICENSE.txt file in the project root.
  31488. */
  31489. // A DFA walker that knows how to dump them to serialized strings.#/
  31490. function DFASerializer(dfa, literalNames, symbolicNames) {
  31491. this.dfa = dfa;
  31492. this.literalNames = literalNames || [];
  31493. this.symbolicNames = symbolicNames || [];
  31494. return this;
  31495. }
  31496. DFASerializer.prototype.toString = function () {
  31497. if (this.dfa.s0 === null) {
  31498. return null;
  31499. }
  31500. var buf = "";
  31501. var states = this.dfa.sortedStates();
  31502. for (var i = 0; i < states.length; i++) {
  31503. var s = states[i];
  31504. if (s.edges !== null) {
  31505. var n = s.edges.length;
  31506. for (var j = 0; j < n; j++) {
  31507. var t = s.edges[j] || null;
  31508. if (t !== null && t.stateNumber !== 0x7FFFFFFF) {
  31509. buf = buf.concat(this.getStateString(s));
  31510. buf = buf.concat("-");
  31511. buf = buf.concat(this.getEdgeLabel(j));
  31512. buf = buf.concat("->");
  31513. buf = buf.concat(this.getStateString(t));
  31514. buf = buf.concat('\n');
  31515. }
  31516. }
  31517. }
  31518. }
  31519. return buf.length === 0 ? null : buf;
  31520. };
  31521. DFASerializer.prototype.getEdgeLabel = function (i) {
  31522. if (i === 0) {
  31523. return "EOF";
  31524. } else if (this.literalNames !== null || this.symbolicNames !== null) {
  31525. return this.literalNames[i - 1] || this.symbolicNames[i - 1];
  31526. } else {
  31527. return String.fromCharCode(i - 1);
  31528. }
  31529. };
  31530. DFASerializer.prototype.getStateString = function (s) {
  31531. var baseStateStr = (s.isAcceptState ? ":" : "") + "s" + s.stateNumber + (s.requiresFullContext ? "^" : "");
  31532. if (s.isAcceptState) {
  31533. if (s.predicates !== null) {
  31534. return baseStateStr + "=>" + s.predicates.toString();
  31535. } else {
  31536. return baseStateStr + "=>" + s.prediction.toString();
  31537. }
  31538. } else {
  31539. return baseStateStr;
  31540. }
  31541. };
  31542. function LexerDFASerializer(dfa) {
  31543. DFASerializer.call(this, dfa, null);
  31544. return this;
  31545. }
  31546. LexerDFASerializer.prototype = Object.create(DFASerializer.prototype);
  31547. LexerDFASerializer.prototype.constructor = LexerDFASerializer;
  31548. LexerDFASerializer.prototype.getEdgeLabel = function (i) {
  31549. return "'" + String.fromCharCode(i) + "'";
  31550. };
  31551. exports.DFASerializer = DFASerializer;
  31552. exports.LexerDFASerializer = LexerDFASerializer;
  31553. /***/ }),
  31554. /***/ "./node_modules/antlr4/dfa/DFAState.js":
  31555. /*!*********************************************!*\
  31556. !*** ./node_modules/antlr4/dfa/DFAState.js ***!
  31557. \*********************************************/
  31558. /*! no static exports found */
  31559. /***/ (function(module, exports, __webpack_require__) {
  31560. "use strict";
  31561. //
  31562. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  31563. * Use of this file is governed by the BSD 3-clause license that
  31564. * can be found in the LICENSE.txt file in the project root.
  31565. */
  31566. ///
  31567. var ATNConfigSet = __webpack_require__(/*! ./../atn/ATNConfigSet */ "./node_modules/antlr4/atn/ATNConfigSet.js").ATNConfigSet;
  31568. var Utils = __webpack_require__(/*! ./../Utils */ "./node_modules/antlr4/Utils.js");
  31569. var Hash = Utils.Hash;
  31570. var Set = Utils.Set;
  31571. // Map a predicate to a predicted alternative.///
  31572. function PredPrediction(pred, alt) {
  31573. this.alt = alt;
  31574. this.pred = pred;
  31575. return this;
  31576. }
  31577. PredPrediction.prototype.toString = function () {
  31578. return "(" + this.pred + ", " + this.alt + ")";
  31579. };
  31580. // A DFA state represents a set of possible ATN configurations.
  31581. // As Aho, Sethi, Ullman p. 117 says "The DFA uses its state
  31582. // to keep track of all possible states the ATN can be in after
  31583. // reading each input symbol. That is to say, after reading
  31584. // input a1a2..an, the DFA is in a state that represents the
  31585. // subset T of the states of the ATN that are reachable from the
  31586. // ATN's start state along some path labeled a1a2..an."
  31587. // In conventional NFA&rarr;DFA conversion, therefore, the subset T
  31588. // would be a bitset representing the set of states the
  31589. // ATN could be in. We need to track the alt predicted by each
  31590. // state as well, however. More importantly, we need to maintain
  31591. // a stack of states, tracking the closure operations as they
  31592. // jump from rule to rule, emulating rule invocations (method calls).
  31593. // I have to add a stack to simulate the proper lookahead sequences for
  31594. // the underlying LL grammar from which the ATN was derived.
  31595. //
  31596. // <p>I use a set of ATNConfig objects not simple states. An ATNConfig
  31597. // is both a state (ala normal conversion) and a RuleContext describing
  31598. // the chain of rules (if any) followed to arrive at that state.</p>
  31599. //
  31600. // <p>A DFA state may have multiple references to a particular state,
  31601. // but with different ATN contexts (with same or different alts)
  31602. // meaning that state was reached via a different set of rule invocations.</p>
  31603. // /
  31604. function DFAState(stateNumber, configs) {
  31605. if (stateNumber === null) {
  31606. stateNumber = -1;
  31607. }
  31608. if (configs === null) {
  31609. configs = new ATNConfigSet();
  31610. }
  31611. this.stateNumber = stateNumber;
  31612. this.configs = configs;
  31613. // {@code edges[symbol]} points to target of symbol. Shift up by 1 so (-1)
  31614. // {@link Token//EOF} maps to {@code edges[0]}.
  31615. this.edges = null;
  31616. this.isAcceptState = false;
  31617. // if accept state, what ttype do we match or alt do we predict?
  31618. // This is set to {@link ATN//INVALID_ALT_NUMBER} when {@link
  31619. // //predicates}{@code !=null} or
  31620. // {@link //requiresFullContext}.
  31621. this.prediction = 0;
  31622. this.lexerActionExecutor = null;
  31623. // Indicates that this state was created during SLL prediction that
  31624. // discovered a conflict between the configurations in the state. Future
  31625. // {@link ParserATNSimulator//execATN} invocations immediately jumped doing
  31626. // full context prediction if this field is true.
  31627. this.requiresFullContext = false;
  31628. // During SLL parsing, this is a list of predicates associated with the
  31629. // ATN configurations of the DFA state. When we have predicates,
  31630. // {@link //requiresFullContext} is {@code false} since full context
  31631. // prediction evaluates predicates
  31632. // on-the-fly. If this is not null, then {@link //prediction} is
  31633. // {@link ATN//INVALID_ALT_NUMBER}.
  31634. //
  31635. // <p>We only use these for non-{@link //requiresFullContext} but
  31636. // conflicting states. That
  31637. // means we know from the context (it's $ or we don't dip into outer
  31638. // context) that it's an ambiguity not a conflict.</p>
  31639. //
  31640. // <p>This list is computed by {@link
  31641. // ParserATNSimulator//predicateDFAState}.</p>
  31642. this.predicates = null;
  31643. return this;
  31644. }
  31645. // Get the set of all alts mentioned by all ATN configurations in this
  31646. // DFA state.
  31647. DFAState.prototype.getAltSet = function () {
  31648. var alts = new Set();
  31649. if (this.configs !== null) {
  31650. for (var i = 0; i < this.configs.length; i++) {
  31651. var c = this.configs[i];
  31652. alts.add(c.alt);
  31653. }
  31654. }
  31655. if (alts.length === 0) {
  31656. return null;
  31657. } else {
  31658. return alts;
  31659. }
  31660. };
  31661. // Two {@link DFAState} instances are equal if their ATN configuration sets
  31662. // are the same. This method is used to see if a state already exists.
  31663. //
  31664. // <p>Because the number of alternatives and number of ATN configurations are
  31665. // finite, there is a finite number of DFA states that can be processed.
  31666. // This is necessary to show that the algorithm terminates.</p>
  31667. //
  31668. // <p>Cannot test the DFA state numbers here because in
  31669. // {@link ParserATNSimulator//addDFAState} we need to know if any other state
  31670. // exists that has this exact set of ATN configurations. The
  31671. // {@link //stateNumber} is irrelevant.</p>
  31672. DFAState.prototype.equals = function (other) {
  31673. // compare set of ATN configurations in this set with other
  31674. return this === other || other instanceof DFAState && this.configs.equals(other.configs);
  31675. };
  31676. DFAState.prototype.toString = function () {
  31677. var s = "" + this.stateNumber + ":" + this.configs;
  31678. if (this.isAcceptState) {
  31679. s = s + "=>";
  31680. if (this.predicates !== null) s = s + this.predicates;else s = s + this.prediction;
  31681. }
  31682. return s;
  31683. };
  31684. DFAState.prototype.hashCode = function () {
  31685. var hash = new Hash();
  31686. hash.update(this.configs);
  31687. if (this.isAcceptState) {
  31688. if (this.predicates !== null) hash.update(this.predicates);else hash.update(this.prediction);
  31689. }
  31690. return hash.finish();
  31691. };
  31692. exports.DFAState = DFAState;
  31693. exports.PredPrediction = PredPrediction;
  31694. /***/ }),
  31695. /***/ "./node_modules/antlr4/dfa/index.js":
  31696. /*!******************************************!*\
  31697. !*** ./node_modules/antlr4/dfa/index.js ***!
  31698. \******************************************/
  31699. /*! no static exports found */
  31700. /***/ (function(module, exports, __webpack_require__) {
  31701. "use strict";
  31702. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  31703. * Use of this file is governed by the BSD 3-clause license that
  31704. * can be found in the LICENSE.txt file in the project root.
  31705. */
  31706. exports.DFA = __webpack_require__(/*! ./DFA */ "./node_modules/antlr4/dfa/DFA.js").DFA;
  31707. exports.DFASerializer = __webpack_require__(/*! ./DFASerializer */ "./node_modules/antlr4/dfa/DFASerializer.js").DFASerializer;
  31708. exports.LexerDFASerializer = __webpack_require__(/*! ./DFASerializer */ "./node_modules/antlr4/dfa/DFASerializer.js").LexerDFASerializer;
  31709. exports.PredPrediction = __webpack_require__(/*! ./DFAState */ "./node_modules/antlr4/dfa/DFAState.js").PredPrediction;
  31710. /***/ }),
  31711. /***/ "./node_modules/antlr4/error/DiagnosticErrorListener.js":
  31712. /*!**************************************************************!*\
  31713. !*** ./node_modules/antlr4/error/DiagnosticErrorListener.js ***!
  31714. \**************************************************************/
  31715. /*! no static exports found */
  31716. /***/ (function(module, exports, __webpack_require__) {
  31717. "use strict";
  31718. //
  31719. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  31720. * Use of this file is governed by the BSD 3-clause license that
  31721. * can be found in the LICENSE.txt file in the project root.
  31722. */
  31723. //
  31724. //
  31725. // This implementation of {@link ANTLRErrorListener} can be used to identify
  31726. // certain potential correctness and performance problems in grammars. "Reports"
  31727. // are made by calling {@link Parser//notifyErrorListeners} with the appropriate
  31728. // message.
  31729. //
  31730. // <ul>
  31731. // <li><b>Ambiguities</b>: These are cases where more than one path through the
  31732. // grammar can match the input.</li>
  31733. // <li><b>Weak context sensitivity</b>: These are cases where full-context
  31734. // prediction resolved an SLL conflict to a unique alternative which equaled the
  31735. // minimum alternative of the SLL conflict.</li>
  31736. // <li><b>Strong (forced) context sensitivity</b>: These are cases where the
  31737. // full-context prediction resolved an SLL conflict to a unique alternative,
  31738. // <em>and</em> the minimum alternative of the SLL conflict was found to not be
  31739. // a truly viable alternative. Two-stage parsing cannot be used for inputs where
  31740. // this situation occurs.</li>
  31741. // </ul>
  31742. var BitSet = __webpack_require__(/*! ./../Utils */ "./node_modules/antlr4/Utils.js").BitSet;
  31743. var ErrorListener = __webpack_require__(/*! ./ErrorListener */ "./node_modules/antlr4/error/ErrorListener.js").ErrorListener;
  31744. var Interval = __webpack_require__(/*! ./../IntervalSet */ "./node_modules/antlr4/IntervalSet.js").Interval;
  31745. function DiagnosticErrorListener(exactOnly) {
  31746. ErrorListener.call(this);
  31747. exactOnly = exactOnly || true;
  31748. // whether all ambiguities or only exact ambiguities are reported.
  31749. this.exactOnly = exactOnly;
  31750. return this;
  31751. }
  31752. DiagnosticErrorListener.prototype = Object.create(ErrorListener.prototype);
  31753. DiagnosticErrorListener.prototype.constructor = DiagnosticErrorListener;
  31754. DiagnosticErrorListener.prototype.reportAmbiguity = function (recognizer, dfa, startIndex, stopIndex, exact, ambigAlts, configs) {
  31755. if (this.exactOnly && !exact) {
  31756. return;
  31757. }
  31758. var msg = "reportAmbiguity d=" + this.getDecisionDescription(recognizer, dfa) + ": ambigAlts=" + this.getConflictingAlts(ambigAlts, configs) + ", input='" + recognizer.getTokenStream().getText(new Interval(startIndex, stopIndex)) + "'";
  31759. recognizer.notifyErrorListeners(msg);
  31760. };
  31761. DiagnosticErrorListener.prototype.reportAttemptingFullContext = function (recognizer, dfa, startIndex, stopIndex, conflictingAlts, configs) {
  31762. var msg = "reportAttemptingFullContext d=" + this.getDecisionDescription(recognizer, dfa) + ", input='" + recognizer.getTokenStream().getText(new Interval(startIndex, stopIndex)) + "'";
  31763. recognizer.notifyErrorListeners(msg);
  31764. };
  31765. DiagnosticErrorListener.prototype.reportContextSensitivity = function (recognizer, dfa, startIndex, stopIndex, prediction, configs) {
  31766. var msg = "reportContextSensitivity d=" + this.getDecisionDescription(recognizer, dfa) + ", input='" + recognizer.getTokenStream().getText(new Interval(startIndex, stopIndex)) + "'";
  31767. recognizer.notifyErrorListeners(msg);
  31768. };
  31769. DiagnosticErrorListener.prototype.getDecisionDescription = function (recognizer, dfa) {
  31770. var decision = dfa.decision;
  31771. var ruleIndex = dfa.atnStartState.ruleIndex;
  31772. var ruleNames = recognizer.ruleNames;
  31773. if (ruleIndex < 0 || ruleIndex >= ruleNames.length) {
  31774. return "" + decision;
  31775. }
  31776. var ruleName = ruleNames[ruleIndex] || null;
  31777. if (ruleName === null || ruleName.length === 0) {
  31778. return "" + decision;
  31779. }
  31780. return "" + decision + " (" + ruleName + ")";
  31781. };
  31782. //
  31783. // Computes the set of conflicting or ambiguous alternatives from a
  31784. // configuration set, if that information was not already provided by the
  31785. // parser.
  31786. //
  31787. // @param reportedAlts The set of conflicting or ambiguous alternatives, as
  31788. // reported by the parser.
  31789. // @param configs The conflicting or ambiguous configuration set.
  31790. // @return Returns {@code reportedAlts} if it is not {@code null}, otherwise
  31791. // returns the set of alternatives represented in {@code configs}.
  31792. //
  31793. DiagnosticErrorListener.prototype.getConflictingAlts = function (reportedAlts, configs) {
  31794. if (reportedAlts !== null) {
  31795. return reportedAlts;
  31796. }
  31797. var result = new BitSet();
  31798. for (var i = 0; i < configs.items.length; i++) {
  31799. result.add(configs.items[i].alt);
  31800. }
  31801. return "{" + result.values().join(", ") + "}";
  31802. };
  31803. exports.DiagnosticErrorListener = DiagnosticErrorListener;
  31804. /***/ }),
  31805. /***/ "./node_modules/antlr4/error/ErrorListener.js":
  31806. /*!****************************************************!*\
  31807. !*** ./node_modules/antlr4/error/ErrorListener.js ***!
  31808. \****************************************************/
  31809. /*! no static exports found */
  31810. /***/ (function(module, exports, __webpack_require__) {
  31811. "use strict";
  31812. //
  31813. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  31814. * Use of this file is governed by the BSD 3-clause license that
  31815. * can be found in the LICENSE.txt file in the project root.
  31816. */
  31817. // Provides an empty default implementation of {@link ANTLRErrorListener}. The
  31818. // default implementation of each method does nothing, but can be overridden as
  31819. // necessary.
  31820. function ErrorListener() {
  31821. return this;
  31822. }
  31823. ErrorListener.prototype.syntaxError = function (recognizer, offendingSymbol, line, column, msg, e) {};
  31824. ErrorListener.prototype.reportAmbiguity = function (recognizer, dfa, startIndex, stopIndex, exact, ambigAlts, configs) {};
  31825. ErrorListener.prototype.reportAttemptingFullContext = function (recognizer, dfa, startIndex, stopIndex, conflictingAlts, configs) {};
  31826. ErrorListener.prototype.reportContextSensitivity = function (recognizer, dfa, startIndex, stopIndex, prediction, configs) {};
  31827. function ConsoleErrorListener() {
  31828. ErrorListener.call(this);
  31829. return this;
  31830. }
  31831. ConsoleErrorListener.prototype = Object.create(ErrorListener.prototype);
  31832. ConsoleErrorListener.prototype.constructor = ConsoleErrorListener;
  31833. //
  31834. // Provides a default instance of {@link ConsoleErrorListener}.
  31835. //
  31836. ConsoleErrorListener.INSTANCE = new ConsoleErrorListener();
  31837. //
  31838. // {@inheritDoc}
  31839. //
  31840. // <p>
  31841. // This implementation prints messages to {@link System//err} containing the
  31842. // values of {@code line}, {@code charPositionInLine}, and {@code msg} using
  31843. // the following format.</p>
  31844. //
  31845. // <pre>
  31846. // line <em>line</em>:<em>charPositionInLine</em> <em>msg</em>
  31847. // </pre>
  31848. //
  31849. ConsoleErrorListener.prototype.syntaxError = function (recognizer, offendingSymbol, line, column, msg, e) {
  31850. console.error("line " + line + ":" + column + " " + msg);
  31851. };
  31852. function ProxyErrorListener(delegates) {
  31853. ErrorListener.call(this);
  31854. if (delegates === null) {
  31855. throw "delegates";
  31856. }
  31857. this.delegates = delegates;
  31858. return this;
  31859. }
  31860. ProxyErrorListener.prototype = Object.create(ErrorListener.prototype);
  31861. ProxyErrorListener.prototype.constructor = ProxyErrorListener;
  31862. ProxyErrorListener.prototype.syntaxError = function (recognizer, offendingSymbol, line, column, msg, e) {
  31863. this.delegates.map(function (d) {
  31864. d.syntaxError(recognizer, offendingSymbol, line, column, msg, e);
  31865. });
  31866. };
  31867. ProxyErrorListener.prototype.reportAmbiguity = function (recognizer, dfa, startIndex, stopIndex, exact, ambigAlts, configs) {
  31868. this.delegates.map(function (d) {
  31869. d.reportAmbiguity(recognizer, dfa, startIndex, stopIndex, exact, ambigAlts, configs);
  31870. });
  31871. };
  31872. ProxyErrorListener.prototype.reportAttemptingFullContext = function (recognizer, dfa, startIndex, stopIndex, conflictingAlts, configs) {
  31873. this.delegates.map(function (d) {
  31874. d.reportAttemptingFullContext(recognizer, dfa, startIndex, stopIndex, conflictingAlts, configs);
  31875. });
  31876. };
  31877. ProxyErrorListener.prototype.reportContextSensitivity = function (recognizer, dfa, startIndex, stopIndex, prediction, configs) {
  31878. this.delegates.map(function (d) {
  31879. d.reportContextSensitivity(recognizer, dfa, startIndex, stopIndex, prediction, configs);
  31880. });
  31881. };
  31882. exports.ErrorListener = ErrorListener;
  31883. exports.ConsoleErrorListener = ConsoleErrorListener;
  31884. exports.ProxyErrorListener = ProxyErrorListener;
  31885. /***/ }),
  31886. /***/ "./node_modules/antlr4/error/ErrorStrategy.js":
  31887. /*!****************************************************!*\
  31888. !*** ./node_modules/antlr4/error/ErrorStrategy.js ***!
  31889. \****************************************************/
  31890. /*! no static exports found */
  31891. /***/ (function(module, exports, __webpack_require__) {
  31892. "use strict";
  31893. //
  31894. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  31895. * Use of this file is governed by the BSD 3-clause license that
  31896. * can be found in the LICENSE.txt file in the project root.
  31897. */
  31898. //
  31899. var Token = __webpack_require__(/*! ./../Token */ "./node_modules/antlr4/Token.js").Token;
  31900. var Errors = __webpack_require__(/*! ./Errors */ "./node_modules/antlr4/error/Errors.js");
  31901. var NoViableAltException = Errors.NoViableAltException;
  31902. var InputMismatchException = Errors.InputMismatchException;
  31903. var FailedPredicateException = Errors.FailedPredicateException;
  31904. var ParseCancellationException = Errors.ParseCancellationException;
  31905. var ATNState = __webpack_require__(/*! ./../atn/ATNState */ "./node_modules/antlr4/atn/ATNState.js").ATNState;
  31906. var Interval = __webpack_require__(/*! ./../IntervalSet */ "./node_modules/antlr4/IntervalSet.js").Interval;
  31907. var IntervalSet = __webpack_require__(/*! ./../IntervalSet */ "./node_modules/antlr4/IntervalSet.js").IntervalSet;
  31908. function ErrorStrategy() {}
  31909. ErrorStrategy.prototype.reset = function (recognizer) {};
  31910. ErrorStrategy.prototype.recoverInline = function (recognizer) {};
  31911. ErrorStrategy.prototype.recover = function (recognizer, e) {};
  31912. ErrorStrategy.prototype.sync = function (recognizer) {};
  31913. ErrorStrategy.prototype.inErrorRecoveryMode = function (recognizer) {};
  31914. ErrorStrategy.prototype.reportError = function (recognizer) {};
  31915. // This is the default implementation of {@link ANTLRErrorStrategy} used for
  31916. // error reporting and recovery in ANTLR parsers.
  31917. //
  31918. function DefaultErrorStrategy() {
  31919. ErrorStrategy.call(this);
  31920. // Indicates whether the error strategy is currently "recovering from an
  31921. // error". This is used to suppress reporting multiple error messages while
  31922. // attempting to recover from a detected syntax error.
  31923. //
  31924. // @see //inErrorRecoveryMode
  31925. //
  31926. this.errorRecoveryMode = false;
  31927. // The index into the input stream where the last error occurred.
  31928. // This is used to prevent infinite loops where an error is found
  31929. // but no token is consumed during recovery...another error is found,
  31930. // ad nauseum. This is a failsafe mechanism to guarantee that at least
  31931. // one token/tree node is consumed for two errors.
  31932. //
  31933. this.lastErrorIndex = -1;
  31934. this.lastErrorStates = null;
  31935. return this;
  31936. }
  31937. DefaultErrorStrategy.prototype = Object.create(ErrorStrategy.prototype);
  31938. DefaultErrorStrategy.prototype.constructor = DefaultErrorStrategy;
  31939. // <p>The default implementation simply calls {@link //endErrorCondition} to
  31940. // ensure that the handler is not in error recovery mode.</p>
  31941. DefaultErrorStrategy.prototype.reset = function (recognizer) {
  31942. this.endErrorCondition(recognizer);
  31943. };
  31944. //
  31945. // This method is called to enter error recovery mode when a recognition
  31946. // exception is reported.
  31947. //
  31948. // @param recognizer the parser instance
  31949. //
  31950. DefaultErrorStrategy.prototype.beginErrorCondition = function (recognizer) {
  31951. this.errorRecoveryMode = true;
  31952. };
  31953. DefaultErrorStrategy.prototype.inErrorRecoveryMode = function (recognizer) {
  31954. return this.errorRecoveryMode;
  31955. };
  31956. //
  31957. // This method is called to leave error recovery mode after recovering from
  31958. // a recognition exception.
  31959. //
  31960. // @param recognizer
  31961. //
  31962. DefaultErrorStrategy.prototype.endErrorCondition = function (recognizer) {
  31963. this.errorRecoveryMode = false;
  31964. this.lastErrorStates = null;
  31965. this.lastErrorIndex = -1;
  31966. };
  31967. //
  31968. // {@inheritDoc}
  31969. //
  31970. // <p>The default implementation simply calls {@link //endErrorCondition}.</p>
  31971. //
  31972. DefaultErrorStrategy.prototype.reportMatch = function (recognizer) {
  31973. this.endErrorCondition(recognizer);
  31974. };
  31975. //
  31976. // {@inheritDoc}
  31977. //
  31978. // <p>The default implementation returns immediately if the handler is already
  31979. // in error recovery mode. Otherwise, it calls {@link //beginErrorCondition}
  31980. // and dispatches the reporting task based on the runtime type of {@code e}
  31981. // according to the following table.</p>
  31982. //
  31983. // <ul>
  31984. // <li>{@link NoViableAltException}: Dispatches the call to
  31985. // {@link //reportNoViableAlternative}</li>
  31986. // <li>{@link InputMismatchException}: Dispatches the call to
  31987. // {@link //reportInputMismatch}</li>
  31988. // <li>{@link FailedPredicateException}: Dispatches the call to
  31989. // {@link //reportFailedPredicate}</li>
  31990. // <li>All other types: calls {@link Parser//notifyErrorListeners} to report
  31991. // the exception</li>
  31992. // </ul>
  31993. //
  31994. DefaultErrorStrategy.prototype.reportError = function (recognizer, e) {
  31995. // if we've already reported an error and have not matched a token
  31996. // yet successfully, don't report any errors.
  31997. if (this.inErrorRecoveryMode(recognizer)) {
  31998. return; // don't report spurious errors
  31999. }
  32000. this.beginErrorCondition(recognizer);
  32001. if (e instanceof NoViableAltException) {
  32002. this.reportNoViableAlternative(recognizer, e);
  32003. } else if (e instanceof InputMismatchException) {
  32004. this.reportInputMismatch(recognizer, e);
  32005. } else if (e instanceof FailedPredicateException) {
  32006. this.reportFailedPredicate(recognizer, e);
  32007. } else {
  32008. console.log("unknown recognition error type: " + e.constructor.name);
  32009. console.log(e.stack);
  32010. recognizer.notifyErrorListeners(e.getOffendingToken(), e.getMessage(), e);
  32011. }
  32012. };
  32013. //
  32014. // {@inheritDoc}
  32015. //
  32016. // <p>The default implementation resynchronizes the parser by consuming tokens
  32017. // until we find one in the resynchronization set--loosely the set of tokens
  32018. // that can follow the current rule.</p>
  32019. //
  32020. DefaultErrorStrategy.prototype.recover = function (recognizer, e) {
  32021. if (this.lastErrorIndex === recognizer.getInputStream().index && this.lastErrorStates !== null && this.lastErrorStates.indexOf(recognizer.state) >= 0) {
  32022. // uh oh, another error at same token index and previously-visited
  32023. // state in ATN; must be a case where LT(1) is in the recovery
  32024. // token set so nothing got consumed. Consume a single token
  32025. // at least to prevent an infinite loop; this is a failsafe.
  32026. recognizer.consume();
  32027. }
  32028. this.lastErrorIndex = recognizer._input.index;
  32029. if (this.lastErrorStates === null) {
  32030. this.lastErrorStates = [];
  32031. }
  32032. this.lastErrorStates.push(recognizer.state);
  32033. var followSet = this.getErrorRecoverySet(recognizer);
  32034. this.consumeUntil(recognizer, followSet);
  32035. };
  32036. // The default implementation of {@link ANTLRErrorStrategy//sync} makes sure
  32037. // that the current lookahead symbol is consistent with what were expecting
  32038. // at this point in the ATN. You can call this anytime but ANTLR only
  32039. // generates code to check before subrules/loops and each iteration.
  32040. //
  32041. // <p>Implements Jim Idle's magic sync mechanism in closures and optional
  32042. // subrules. E.g.,</p>
  32043. //
  32044. // <pre>
  32045. // a : sync ( stuff sync )* ;
  32046. // sync : {consume to what can follow sync} ;
  32047. // </pre>
  32048. //
  32049. // At the start of a sub rule upon error, {@link //sync} performs single
  32050. // token deletion, if possible. If it can't do that, it bails on the current
  32051. // rule and uses the default error recovery, which consumes until the
  32052. // resynchronization set of the current rule.
  32053. //
  32054. // <p>If the sub rule is optional ({@code (...)?}, {@code (...)*}, or block
  32055. // with an empty alternative), then the expected set includes what follows
  32056. // the subrule.</p>
  32057. //
  32058. // <p>During loop iteration, it consumes until it sees a token that can start a
  32059. // sub rule or what follows loop. Yes, that is pretty aggressive. We opt to
  32060. // stay in the loop as long as possible.</p>
  32061. //
  32062. // <p><strong>ORIGINS</strong></p>
  32063. //
  32064. // <p>Previous versions of ANTLR did a poor job of their recovery within loops.
  32065. // A single mismatch token or missing token would force the parser to bail
  32066. // out of the entire rules surrounding the loop. So, for rule</p>
  32067. //
  32068. // <pre>
  32069. // classDef : 'class' ID '{' member* '}'
  32070. // </pre>
  32071. //
  32072. // input with an extra token between members would force the parser to
  32073. // consume until it found the next class definition rather than the next
  32074. // member definition of the current class.
  32075. //
  32076. // <p>This functionality cost a little bit of effort because the parser has to
  32077. // compare token set at the start of the loop and at each iteration. If for
  32078. // some reason speed is suffering for you, you can turn off this
  32079. // functionality by simply overriding this method as a blank { }.</p>
  32080. //
  32081. DefaultErrorStrategy.prototype.sync = function (recognizer) {
  32082. // If already recovering, don't try to sync
  32083. if (this.inErrorRecoveryMode(recognizer)) {
  32084. return;
  32085. }
  32086. var s = recognizer._interp.atn.states[recognizer.state];
  32087. var la = recognizer.getTokenStream().LA(1);
  32088. // try cheaper subset first; might get lucky. seems to shave a wee bit off
  32089. var nextTokens = recognizer.atn.nextTokens(s);
  32090. if (nextTokens.contains(Token.EPSILON) || nextTokens.contains(la)) {
  32091. return;
  32092. }
  32093. switch (s.stateType) {
  32094. case ATNState.BLOCK_START:
  32095. case ATNState.STAR_BLOCK_START:
  32096. case ATNState.PLUS_BLOCK_START:
  32097. case ATNState.STAR_LOOP_ENTRY:
  32098. // report error and recover if possible
  32099. if (this.singleTokenDeletion(recognizer) !== null) {
  32100. return;
  32101. } else {
  32102. throw new InputMismatchException(recognizer);
  32103. }
  32104. break;
  32105. case ATNState.PLUS_LOOP_BACK:
  32106. case ATNState.STAR_LOOP_BACK:
  32107. this.reportUnwantedToken(recognizer);
  32108. var expecting = new IntervalSet();
  32109. expecting.addSet(recognizer.getExpectedTokens());
  32110. var whatFollowsLoopIterationOrRule = expecting.addSet(this.getErrorRecoverySet(recognizer));
  32111. this.consumeUntil(recognizer, whatFollowsLoopIterationOrRule);
  32112. break;
  32113. default:
  32114. // do nothing if we can't identify the exact kind of ATN state
  32115. }
  32116. };
  32117. // This is called by {@link //reportError} when the exception is a
  32118. // {@link NoViableAltException}.
  32119. //
  32120. // @see //reportError
  32121. //
  32122. // @param recognizer the parser instance
  32123. // @param e the recognition exception
  32124. //
  32125. DefaultErrorStrategy.prototype.reportNoViableAlternative = function (recognizer, e) {
  32126. var tokens = recognizer.getTokenStream();
  32127. var input;
  32128. if (tokens !== null) {
  32129. if (e.startToken.type === Token.EOF) {
  32130. input = "<EOF>";
  32131. } else {
  32132. input = tokens.getText(new Interval(e.startToken.tokenIndex, e.offendingToken.tokenIndex));
  32133. }
  32134. } else {
  32135. input = "<unknown input>";
  32136. }
  32137. var msg = "no viable alternative at input " + this.escapeWSAndQuote(input);
  32138. recognizer.notifyErrorListeners(msg, e.offendingToken, e);
  32139. };
  32140. //
  32141. // This is called by {@link //reportError} when the exception is an
  32142. // {@link InputMismatchException}.
  32143. //
  32144. // @see //reportError
  32145. //
  32146. // @param recognizer the parser instance
  32147. // @param e the recognition exception
  32148. //
  32149. DefaultErrorStrategy.prototype.reportInputMismatch = function (recognizer, e) {
  32150. var msg = "mismatched input " + this.getTokenErrorDisplay(e.offendingToken) + " expecting " + e.getExpectedTokens().toString(recognizer.literalNames, recognizer.symbolicNames);
  32151. recognizer.notifyErrorListeners(msg, e.offendingToken, e);
  32152. };
  32153. //
  32154. // This is called by {@link //reportError} when the exception is a
  32155. // {@link FailedPredicateException}.
  32156. //
  32157. // @see //reportError
  32158. //
  32159. // @param recognizer the parser instance
  32160. // @param e the recognition exception
  32161. //
  32162. DefaultErrorStrategy.prototype.reportFailedPredicate = function (recognizer, e) {
  32163. var ruleName = recognizer.ruleNames[recognizer._ctx.ruleIndex];
  32164. var msg = "rule " + ruleName + " " + e.message;
  32165. recognizer.notifyErrorListeners(msg, e.offendingToken, e);
  32166. };
  32167. // This method is called to report a syntax error which requires the removal
  32168. // of a token from the input stream. At the time this method is called, the
  32169. // erroneous symbol is current {@code LT(1)} symbol and has not yet been
  32170. // removed from the input stream. When this method returns,
  32171. // {@code recognizer} is in error recovery mode.
  32172. //
  32173. // <p>This method is called when {@link //singleTokenDeletion} identifies
  32174. // single-token deletion as a viable recovery strategy for a mismatched
  32175. // input error.</p>
  32176. //
  32177. // <p>The default implementation simply returns if the handler is already in
  32178. // error recovery mode. Otherwise, it calls {@link //beginErrorCondition} to
  32179. // enter error recovery mode, followed by calling
  32180. // {@link Parser//notifyErrorListeners}.</p>
  32181. //
  32182. // @param recognizer the parser instance
  32183. //
  32184. DefaultErrorStrategy.prototype.reportUnwantedToken = function (recognizer) {
  32185. if (this.inErrorRecoveryMode(recognizer)) {
  32186. return;
  32187. }
  32188. this.beginErrorCondition(recognizer);
  32189. var t = recognizer.getCurrentToken();
  32190. var tokenName = this.getTokenErrorDisplay(t);
  32191. var expecting = this.getExpectedTokens(recognizer);
  32192. var msg = "extraneous input " + tokenName + " expecting " + expecting.toString(recognizer.literalNames, recognizer.symbolicNames);
  32193. recognizer.notifyErrorListeners(msg, t, null);
  32194. };
  32195. // This method is called to report a syntax error which requires the
  32196. // insertion of a missing token into the input stream. At the time this
  32197. // method is called, the missing token has not yet been inserted. When this
  32198. // method returns, {@code recognizer} is in error recovery mode.
  32199. //
  32200. // <p>This method is called when {@link //singleTokenInsertion} identifies
  32201. // single-token insertion as a viable recovery strategy for a mismatched
  32202. // input error.</p>
  32203. //
  32204. // <p>The default implementation simply returns if the handler is already in
  32205. // error recovery mode. Otherwise, it calls {@link //beginErrorCondition} to
  32206. // enter error recovery mode, followed by calling
  32207. // {@link Parser//notifyErrorListeners}.</p>
  32208. //
  32209. // @param recognizer the parser instance
  32210. //
  32211. DefaultErrorStrategy.prototype.reportMissingToken = function (recognizer) {
  32212. if (this.inErrorRecoveryMode(recognizer)) {
  32213. return;
  32214. }
  32215. this.beginErrorCondition(recognizer);
  32216. var t = recognizer.getCurrentToken();
  32217. var expecting = this.getExpectedTokens(recognizer);
  32218. var msg = "missing " + expecting.toString(recognizer.literalNames, recognizer.symbolicNames) + " at " + this.getTokenErrorDisplay(t);
  32219. recognizer.notifyErrorListeners(msg, t, null);
  32220. };
  32221. // <p>The default implementation attempts to recover from the mismatched input
  32222. // by using single token insertion and deletion as described below. If the
  32223. // recovery attempt fails, this method throws an
  32224. // {@link InputMismatchException}.</p>
  32225. //
  32226. // <p><strong>EXTRA TOKEN</strong> (single token deletion)</p>
  32227. //
  32228. // <p>{@code LA(1)} is not what we are looking for. If {@code LA(2)} has the
  32229. // right token, however, then assume {@code LA(1)} is some extra spurious
  32230. // token and delete it. Then consume and return the next token (which was
  32231. // the {@code LA(2)} token) as the successful result of the match operation.</p>
  32232. //
  32233. // <p>This recovery strategy is implemented by {@link
  32234. // //singleTokenDeletion}.</p>
  32235. //
  32236. // <p><strong>MISSING TOKEN</strong> (single token insertion)</p>
  32237. //
  32238. // <p>If current token (at {@code LA(1)}) is consistent with what could come
  32239. // after the expected {@code LA(1)} token, then assume the token is missing
  32240. // and use the parser's {@link TokenFactory} to create it on the fly. The
  32241. // "insertion" is performed by returning the created token as the successful
  32242. // result of the match operation.</p>
  32243. //
  32244. // <p>This recovery strategy is implemented by {@link
  32245. // //singleTokenInsertion}.</p>
  32246. //
  32247. // <p><strong>EXAMPLE</strong></p>
  32248. //
  32249. // <p>For example, Input {@code i=(3;} is clearly missing the {@code ')'}. When
  32250. // the parser returns from the nested call to {@code expr}, it will have
  32251. // call chain:</p>
  32252. //
  32253. // <pre>
  32254. // stat &rarr; expr &rarr; atom
  32255. // </pre>
  32256. //
  32257. // and it will be trying to match the {@code ')'} at this point in the
  32258. // derivation:
  32259. //
  32260. // <pre>
  32261. // =&gt; ID '=' '(' INT ')' ('+' atom)* ';'
  32262. // ^
  32263. // </pre>
  32264. //
  32265. // The attempt to match {@code ')'} will fail when it sees {@code ';'} and
  32266. // call {@link //recoverInline}. To recover, it sees that {@code LA(1)==';'}
  32267. // is in the set of tokens that can follow the {@code ')'} token reference
  32268. // in rule {@code atom}. It can assume that you forgot the {@code ')'}.
  32269. //
  32270. DefaultErrorStrategy.prototype.recoverInline = function (recognizer) {
  32271. // SINGLE TOKEN DELETION
  32272. var matchedSymbol = this.singleTokenDeletion(recognizer);
  32273. if (matchedSymbol !== null) {
  32274. // we have deleted the extra token.
  32275. // now, move past ttype token as if all were ok
  32276. recognizer.consume();
  32277. return matchedSymbol;
  32278. }
  32279. // SINGLE TOKEN INSERTION
  32280. if (this.singleTokenInsertion(recognizer)) {
  32281. return this.getMissingSymbol(recognizer);
  32282. }
  32283. // even that didn't work; must throw the exception
  32284. throw new InputMismatchException(recognizer);
  32285. };
  32286. //
  32287. // This method implements the single-token insertion inline error recovery
  32288. // strategy. It is called by {@link //recoverInline} if the single-token
  32289. // deletion strategy fails to recover from the mismatched input. If this
  32290. // method returns {@code true}, {@code recognizer} will be in error recovery
  32291. // mode.
  32292. //
  32293. // <p>This method determines whether or not single-token insertion is viable by
  32294. // checking if the {@code LA(1)} input symbol could be successfully matched
  32295. // if it were instead the {@code LA(2)} symbol. If this method returns
  32296. // {@code true}, the caller is responsible for creating and inserting a
  32297. // token with the correct type to produce this behavior.</p>
  32298. //
  32299. // @param recognizer the parser instance
  32300. // @return {@code true} if single-token insertion is a viable recovery
  32301. // strategy for the current mismatched input, otherwise {@code false}
  32302. //
  32303. DefaultErrorStrategy.prototype.singleTokenInsertion = function (recognizer) {
  32304. var currentSymbolType = recognizer.getTokenStream().LA(1);
  32305. // if current token is consistent with what could come after current
  32306. // ATN state, then we know we're missing a token; error recovery
  32307. // is free to conjure up and insert the missing token
  32308. var atn = recognizer._interp.atn;
  32309. var currentState = atn.states[recognizer.state];
  32310. var next = currentState.transitions[0].target;
  32311. var expectingAtLL2 = atn.nextTokens(next, recognizer._ctx);
  32312. if (expectingAtLL2.contains(currentSymbolType)) {
  32313. this.reportMissingToken(recognizer);
  32314. return true;
  32315. } else {
  32316. return false;
  32317. }
  32318. };
  32319. // This method implements the single-token deletion inline error recovery
  32320. // strategy. It is called by {@link //recoverInline} to attempt to recover
  32321. // from mismatched input. If this method returns null, the parser and error
  32322. // handler state will not have changed. If this method returns non-null,
  32323. // {@code recognizer} will <em>not</em> be in error recovery mode since the
  32324. // returned token was a successful match.
  32325. //
  32326. // <p>If the single-token deletion is successful, this method calls
  32327. // {@link //reportUnwantedToken} to report the error, followed by
  32328. // {@link Parser//consume} to actually "delete" the extraneous token. Then,
  32329. // before returning {@link //reportMatch} is called to signal a successful
  32330. // match.</p>
  32331. //
  32332. // @param recognizer the parser instance
  32333. // @return the successfully matched {@link Token} instance if single-token
  32334. // deletion successfully recovers from the mismatched input, otherwise
  32335. // {@code null}
  32336. //
  32337. DefaultErrorStrategy.prototype.singleTokenDeletion = function (recognizer) {
  32338. var nextTokenType = recognizer.getTokenStream().LA(2);
  32339. var expecting = this.getExpectedTokens(recognizer);
  32340. if (expecting.contains(nextTokenType)) {
  32341. this.reportUnwantedToken(recognizer);
  32342. // print("recoverFromMismatchedToken deleting " \
  32343. // + str(recognizer.getTokenStream().LT(1)) \
  32344. // + " since " + str(recognizer.getTokenStream().LT(2)) \
  32345. // + " is what we want", file=sys.stderr)
  32346. recognizer.consume(); // simply delete extra token
  32347. // we want to return the token we're actually matching
  32348. var matchedSymbol = recognizer.getCurrentToken();
  32349. this.reportMatch(recognizer); // we know current token is correct
  32350. return matchedSymbol;
  32351. } else {
  32352. return null;
  32353. }
  32354. };
  32355. // Conjure up a missing token during error recovery.
  32356. //
  32357. // The recognizer attempts to recover from single missing
  32358. // symbols. But, actions might refer to that missing symbol.
  32359. // For example, x=ID {f($x);}. The action clearly assumes
  32360. // that there has been an identifier matched previously and that
  32361. // $x points at that token. If that token is missing, but
  32362. // the next token in the stream is what we want we assume that
  32363. // this token is missing and we keep going. Because we
  32364. // have to return some token to replace the missing token,
  32365. // we have to conjure one up. This method gives the user control
  32366. // over the tokens returned for missing tokens. Mostly,
  32367. // you will want to create something special for identifier
  32368. // tokens. For literals such as '{' and ',', the default
  32369. // action in the parser or tree parser works. It simply creates
  32370. // a CommonToken of the appropriate type. The text will be the token.
  32371. // If you change what tokens must be created by the lexer,
  32372. // override this method to create the appropriate tokens.
  32373. //
  32374. DefaultErrorStrategy.prototype.getMissingSymbol = function (recognizer) {
  32375. var currentSymbol = recognizer.getCurrentToken();
  32376. var expecting = this.getExpectedTokens(recognizer);
  32377. var expectedTokenType = expecting.first(); // get any element
  32378. var tokenText;
  32379. if (expectedTokenType === Token.EOF) {
  32380. tokenText = "<missing EOF>";
  32381. } else {
  32382. tokenText = "<missing " + recognizer.literalNames[expectedTokenType] + ">";
  32383. }
  32384. var current = currentSymbol;
  32385. var lookback = recognizer.getTokenStream().LT(-1);
  32386. if (current.type === Token.EOF && lookback !== null) {
  32387. current = lookback;
  32388. }
  32389. return recognizer.getTokenFactory().create(current.source, expectedTokenType, tokenText, Token.DEFAULT_CHANNEL, -1, -1, current.line, current.column);
  32390. };
  32391. DefaultErrorStrategy.prototype.getExpectedTokens = function (recognizer) {
  32392. return recognizer.getExpectedTokens();
  32393. };
  32394. // How should a token be displayed in an error message? The default
  32395. // is to display just the text, but during development you might
  32396. // want to have a lot of information spit out. Override in that case
  32397. // to use t.toString() (which, for CommonToken, dumps everything about
  32398. // the token). This is better than forcing you to override a method in
  32399. // your token objects because you don't have to go modify your lexer
  32400. // so that it creates a new Java type.
  32401. //
  32402. DefaultErrorStrategy.prototype.getTokenErrorDisplay = function (t) {
  32403. if (t === null) {
  32404. return "<no token>";
  32405. }
  32406. var s = t.text;
  32407. if (s === null) {
  32408. if (t.type === Token.EOF) {
  32409. s = "<EOF>";
  32410. } else {
  32411. s = "<" + t.type + ">";
  32412. }
  32413. }
  32414. return this.escapeWSAndQuote(s);
  32415. };
  32416. DefaultErrorStrategy.prototype.escapeWSAndQuote = function (s) {
  32417. s = s.replace(/\n/g, "\\n");
  32418. s = s.replace(/\r/g, "\\r");
  32419. s = s.replace(/\t/g, "\\t");
  32420. return "'" + s + "'";
  32421. };
  32422. // Compute the error recovery set for the current rule. During
  32423. // rule invocation, the parser pushes the set of tokens that can
  32424. // follow that rule reference on the stack; this amounts to
  32425. // computing FIRST of what follows the rule reference in the
  32426. // enclosing rule. See LinearApproximator.FIRST().
  32427. // This local follow set only includes tokens
  32428. // from within the rule; i.e., the FIRST computation done by
  32429. // ANTLR stops at the end of a rule.
  32430. //
  32431. // EXAMPLE
  32432. //
  32433. // When you find a "no viable alt exception", the input is not
  32434. // consistent with any of the alternatives for rule r. The best
  32435. // thing to do is to consume tokens until you see something that
  32436. // can legally follow a call to r//or* any rule that called r.
  32437. // You don't want the exact set of viable next tokens because the
  32438. // input might just be missing a token--you might consume the
  32439. // rest of the input looking for one of the missing tokens.
  32440. //
  32441. // Consider grammar:
  32442. //
  32443. // a : '[' b ']'
  32444. // | '(' b ')'
  32445. // ;
  32446. // b : c '^' INT ;
  32447. // c : ID
  32448. // | INT
  32449. // ;
  32450. //
  32451. // At each rule invocation, the set of tokens that could follow
  32452. // that rule is pushed on a stack. Here are the various
  32453. // context-sensitive follow sets:
  32454. //
  32455. // FOLLOW(b1_in_a) = FIRST(']') = ']'
  32456. // FOLLOW(b2_in_a) = FIRST(')') = ')'
  32457. // FOLLOW(c_in_b) = FIRST('^') = '^'
  32458. //
  32459. // Upon erroneous input "[]", the call chain is
  32460. //
  32461. // a -> b -> c
  32462. //
  32463. // and, hence, the follow context stack is:
  32464. //
  32465. // depth follow set start of rule execution
  32466. // 0 <EOF> a (from main())
  32467. // 1 ']' b
  32468. // 2 '^' c
  32469. //
  32470. // Notice that ')' is not included, because b would have to have
  32471. // been called from a different context in rule a for ')' to be
  32472. // included.
  32473. //
  32474. // For error recovery, we cannot consider FOLLOW(c)
  32475. // (context-sensitive or otherwise). We need the combined set of
  32476. // all context-sensitive FOLLOW sets--the set of all tokens that
  32477. // could follow any reference in the call chain. We need to
  32478. // resync to one of those tokens. Note that FOLLOW(c)='^' and if
  32479. // we resync'd to that token, we'd consume until EOF. We need to
  32480. // sync to context-sensitive FOLLOWs for a, b, and c: {']','^'}.
  32481. // In this case, for input "[]", LA(1) is ']' and in the set, so we would
  32482. // not consume anything. After printing an error, rule c would
  32483. // return normally. Rule b would not find the required '^' though.
  32484. // At this point, it gets a mismatched token error and throws an
  32485. // exception (since LA(1) is not in the viable following token
  32486. // set). The rule exception handler tries to recover, but finds
  32487. // the same recovery set and doesn't consume anything. Rule b
  32488. // exits normally returning to rule a. Now it finds the ']' (and
  32489. // with the successful match exits errorRecovery mode).
  32490. //
  32491. // So, you can see that the parser walks up the call chain looking
  32492. // for the token that was a member of the recovery set.
  32493. //
  32494. // Errors are not generated in errorRecovery mode.
  32495. //
  32496. // ANTLR's error recovery mechanism is based upon original ideas:
  32497. //
  32498. // "Algorithms + Data Structures = Programs" by Niklaus Wirth
  32499. //
  32500. // and
  32501. //
  32502. // "A note on error recovery in recursive descent parsers":
  32503. // http://portal.acm.org/citation.cfm?id=947902.947905
  32504. //
  32505. // Later, Josef Grosch had some good ideas:
  32506. //
  32507. // "Efficient and Comfortable Error Recovery in Recursive Descent
  32508. // Parsers":
  32509. // ftp://www.cocolab.com/products/cocktail/doca4.ps/ell.ps.zip
  32510. //
  32511. // Like Grosch I implement context-sensitive FOLLOW sets that are combined
  32512. // at run-time upon error to avoid overhead during parsing.
  32513. //
  32514. DefaultErrorStrategy.prototype.getErrorRecoverySet = function (recognizer) {
  32515. var atn = recognizer._interp.atn;
  32516. var ctx = recognizer._ctx;
  32517. var recoverSet = new IntervalSet();
  32518. while (ctx !== null && ctx.invokingState >= 0) {
  32519. // compute what follows who invoked us
  32520. var invokingState = atn.states[ctx.invokingState];
  32521. var rt = invokingState.transitions[0];
  32522. var follow = atn.nextTokens(rt.followState);
  32523. recoverSet.addSet(follow);
  32524. ctx = ctx.parentCtx;
  32525. }
  32526. recoverSet.removeOne(Token.EPSILON);
  32527. return recoverSet;
  32528. };
  32529. // Consume tokens until one matches the given token set.//
  32530. DefaultErrorStrategy.prototype.consumeUntil = function (recognizer, set) {
  32531. var ttype = recognizer.getTokenStream().LA(1);
  32532. while (ttype !== Token.EOF && !set.contains(ttype)) {
  32533. recognizer.consume();
  32534. ttype = recognizer.getTokenStream().LA(1);
  32535. }
  32536. };
  32537. //
  32538. // This implementation of {@link ANTLRErrorStrategy} responds to syntax errors
  32539. // by immediately canceling the parse operation with a
  32540. // {@link ParseCancellationException}. The implementation ensures that the
  32541. // {@link ParserRuleContext//exception} field is set for all parse tree nodes
  32542. // that were not completed prior to encountering the error.
  32543. //
  32544. // <p>
  32545. // This error strategy is useful in the following scenarios.</p>
  32546. //
  32547. // <ul>
  32548. // <li><strong>Two-stage parsing:</strong> This error strategy allows the first
  32549. // stage of two-stage parsing to immediately terminate if an error is
  32550. // encountered, and immediately fall back to the second stage. In addition to
  32551. // avoiding wasted work by attempting to recover from errors here, the empty
  32552. // implementation of {@link BailErrorStrategy//sync} improves the performance of
  32553. // the first stage.</li>
  32554. // <li><strong>Silent validation:</strong> When syntax errors are not being
  32555. // reported or logged, and the parse result is simply ignored if errors occur,
  32556. // the {@link BailErrorStrategy} avoids wasting work on recovering from errors
  32557. // when the result will be ignored either way.</li>
  32558. // </ul>
  32559. //
  32560. // <p>
  32561. // {@code myparser.setErrorHandler(new BailErrorStrategy());}</p>
  32562. //
  32563. // @see Parser//setErrorHandler(ANTLRErrorStrategy)
  32564. //
  32565. function BailErrorStrategy() {
  32566. DefaultErrorStrategy.call(this);
  32567. return this;
  32568. }
  32569. BailErrorStrategy.prototype = Object.create(DefaultErrorStrategy.prototype);
  32570. BailErrorStrategy.prototype.constructor = BailErrorStrategy;
  32571. // Instead of recovering from exception {@code e}, re-throw it wrapped
  32572. // in a {@link ParseCancellationException} so it is not caught by the
  32573. // rule function catches. Use {@link Exception//getCause()} to get the
  32574. // original {@link RecognitionException}.
  32575. //
  32576. BailErrorStrategy.prototype.recover = function (recognizer, e) {
  32577. var context = recognizer._ctx;
  32578. while (context !== null) {
  32579. context.exception = e;
  32580. context = context.parentCtx;
  32581. }
  32582. throw new ParseCancellationException(e);
  32583. };
  32584. // Make sure we don't attempt to recover inline; if the parser
  32585. // successfully recovers, it won't throw an exception.
  32586. //
  32587. BailErrorStrategy.prototype.recoverInline = function (recognizer) {
  32588. this.recover(recognizer, new InputMismatchException(recognizer));
  32589. };
  32590. // Make sure we don't attempt to recover from problems in subrules.//
  32591. BailErrorStrategy.prototype.sync = function (recognizer) {
  32592. // pass
  32593. };
  32594. exports.BailErrorStrategy = BailErrorStrategy;
  32595. exports.DefaultErrorStrategy = DefaultErrorStrategy;
  32596. /***/ }),
  32597. /***/ "./node_modules/antlr4/error/Errors.js":
  32598. /*!*********************************************!*\
  32599. !*** ./node_modules/antlr4/error/Errors.js ***!
  32600. \*********************************************/
  32601. /*! no static exports found */
  32602. /***/ (function(module, exports, __webpack_require__) {
  32603. "use strict";
  32604. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  32605. * Use of this file is governed by the BSD 3-clause license that
  32606. * can be found in the LICENSE.txt file in the project root.
  32607. */
  32608. // The root of the ANTLR exception hierarchy. In general, ANTLR tracks just
  32609. // 3 kinds of errors: prediction errors, failed predicate errors, and
  32610. // mismatched input errors. In each case, the parser knows where it is
  32611. // in the input, where it is in the ATN, the rule invocation stack,
  32612. // and what kind of problem occurred.
  32613. var PredicateTransition = __webpack_require__(/*! ./../atn/Transition */ "./node_modules/antlr4/atn/Transition.js").PredicateTransition;
  32614. function RecognitionException(params) {
  32615. Error.call(this);
  32616. if (!!Error.captureStackTrace) {
  32617. Error.captureStackTrace(this, RecognitionException);
  32618. } else {
  32619. var stack = new Error().stack;
  32620. }
  32621. this.message = params.message;
  32622. this.recognizer = params.recognizer;
  32623. this.input = params.input;
  32624. this.ctx = params.ctx;
  32625. // The current {@link Token} when an error occurred. Since not all streams
  32626. // support accessing symbols by index, we have to track the {@link Token}
  32627. // instance itself.
  32628. this.offendingToken = null;
  32629. // Get the ATN state number the parser was in at the time the error
  32630. // occurred. For {@link NoViableAltException} and
  32631. // {@link LexerNoViableAltException} exceptions, this is the
  32632. // {@link DecisionState} number. For others, it is the state whose outgoing
  32633. // edge we couldn't match.
  32634. this.offendingState = -1;
  32635. if (this.recognizer !== null) {
  32636. this.offendingState = this.recognizer.state;
  32637. }
  32638. return this;
  32639. }
  32640. RecognitionException.prototype = Object.create(Error.prototype);
  32641. RecognitionException.prototype.constructor = RecognitionException;
  32642. // <p>If the state number is not known, this method returns -1.</p>
  32643. //
  32644. // Gets the set of input symbols which could potentially follow the
  32645. // previously matched symbol at the time this exception was thrown.
  32646. //
  32647. // <p>If the set of expected tokens is not known and could not be computed,
  32648. // this method returns {@code null}.</p>
  32649. //
  32650. // @return The set of token types that could potentially follow the current
  32651. // state in the ATN, or {@code null} if the information is not available.
  32652. // /
  32653. RecognitionException.prototype.getExpectedTokens = function () {
  32654. if (this.recognizer !== null) {
  32655. return this.recognizer.atn.getExpectedTokens(this.offendingState, this.ctx);
  32656. } else {
  32657. return null;
  32658. }
  32659. };
  32660. RecognitionException.prototype.toString = function () {
  32661. return this.message;
  32662. };
  32663. function LexerNoViableAltException(lexer, input, startIndex, deadEndConfigs) {
  32664. RecognitionException.call(this, { message: "", recognizer: lexer, input: input, ctx: null });
  32665. this.startIndex = startIndex;
  32666. this.deadEndConfigs = deadEndConfigs;
  32667. return this;
  32668. }
  32669. LexerNoViableAltException.prototype = Object.create(RecognitionException.prototype);
  32670. LexerNoViableAltException.prototype.constructor = LexerNoViableAltException;
  32671. LexerNoViableAltException.prototype.toString = function () {
  32672. var symbol = "";
  32673. if (this.startIndex >= 0 && this.startIndex < this.input.size) {
  32674. symbol = this.input.getText((this.startIndex, this.startIndex));
  32675. }
  32676. return "LexerNoViableAltException" + symbol;
  32677. };
  32678. // Indicates that the parser could not decide which of two or more paths
  32679. // to take based upon the remaining input. It tracks the starting token
  32680. // of the offending input and also knows where the parser was
  32681. // in the various paths when the error. Reported by reportNoViableAlternative()
  32682. //
  32683. function NoViableAltException(recognizer, input, startToken, offendingToken, deadEndConfigs, ctx) {
  32684. ctx = ctx || recognizer._ctx;
  32685. offendingToken = offendingToken || recognizer.getCurrentToken();
  32686. startToken = startToken || recognizer.getCurrentToken();
  32687. input = input || recognizer.getInputStream();
  32688. RecognitionException.call(this, { message: "", recognizer: recognizer, input: input, ctx: ctx });
  32689. // Which configurations did we try at input.index() that couldn't match
  32690. // input.LT(1)?//
  32691. this.deadEndConfigs = deadEndConfigs;
  32692. // The token object at the start index; the input stream might
  32693. // not be buffering tokens so get a reference to it. (At the
  32694. // time the error occurred, of course the stream needs to keep a
  32695. // buffer all of the tokens but later we might not have access to those.)
  32696. this.startToken = startToken;
  32697. this.offendingToken = offendingToken;
  32698. }
  32699. NoViableAltException.prototype = Object.create(RecognitionException.prototype);
  32700. NoViableAltException.prototype.constructor = NoViableAltException;
  32701. // This signifies any kind of mismatched input exceptions such as
  32702. // when the current input does not match the expected token.
  32703. //
  32704. function InputMismatchException(recognizer) {
  32705. RecognitionException.call(this, { message: "", recognizer: recognizer, input: recognizer.getInputStream(), ctx: recognizer._ctx });
  32706. this.offendingToken = recognizer.getCurrentToken();
  32707. }
  32708. InputMismatchException.prototype = Object.create(RecognitionException.prototype);
  32709. InputMismatchException.prototype.constructor = InputMismatchException;
  32710. // A semantic predicate failed during validation. Validation of predicates
  32711. // occurs when normally parsing the alternative just like matching a token.
  32712. // Disambiguating predicate evaluation occurs when we test a predicate during
  32713. // prediction.
  32714. function FailedPredicateException(recognizer, predicate, message) {
  32715. RecognitionException.call(this, { message: this.formatMessage(predicate, message || null), recognizer: recognizer,
  32716. input: recognizer.getInputStream(), ctx: recognizer._ctx });
  32717. var s = recognizer._interp.atn.states[recognizer.state];
  32718. var trans = s.transitions[0];
  32719. if (trans instanceof PredicateTransition) {
  32720. this.ruleIndex = trans.ruleIndex;
  32721. this.predicateIndex = trans.predIndex;
  32722. } else {
  32723. this.ruleIndex = 0;
  32724. this.predicateIndex = 0;
  32725. }
  32726. this.predicate = predicate;
  32727. this.offendingToken = recognizer.getCurrentToken();
  32728. return this;
  32729. }
  32730. FailedPredicateException.prototype = Object.create(RecognitionException.prototype);
  32731. FailedPredicateException.prototype.constructor = FailedPredicateException;
  32732. FailedPredicateException.prototype.formatMessage = function (predicate, message) {
  32733. if (message !== null) {
  32734. return message;
  32735. } else {
  32736. return "failed predicate: {" + predicate + "}?";
  32737. }
  32738. };
  32739. function ParseCancellationException() {
  32740. Error.call(this);
  32741. Error.captureStackTrace(this, ParseCancellationException);
  32742. return this;
  32743. }
  32744. ParseCancellationException.prototype = Object.create(Error.prototype);
  32745. ParseCancellationException.prototype.constructor = ParseCancellationException;
  32746. exports.RecognitionException = RecognitionException;
  32747. exports.NoViableAltException = NoViableAltException;
  32748. exports.LexerNoViableAltException = LexerNoViableAltException;
  32749. exports.InputMismatchException = InputMismatchException;
  32750. exports.FailedPredicateException = FailedPredicateException;
  32751. exports.ParseCancellationException = ParseCancellationException;
  32752. /***/ }),
  32753. /***/ "./node_modules/antlr4/error/index.js":
  32754. /*!********************************************!*\
  32755. !*** ./node_modules/antlr4/error/index.js ***!
  32756. \********************************************/
  32757. /*! no static exports found */
  32758. /***/ (function(module, exports, __webpack_require__) {
  32759. "use strict";
  32760. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  32761. * Use of this file is governed by the BSD 3-clause license that
  32762. * can be found in the LICENSE.txt file in the project root.
  32763. */
  32764. exports.RecognitionException = __webpack_require__(/*! ./Errors */ "./node_modules/antlr4/error/Errors.js").RecognitionException;
  32765. exports.NoViableAltException = __webpack_require__(/*! ./Errors */ "./node_modules/antlr4/error/Errors.js").NoViableAltException;
  32766. exports.LexerNoViableAltException = __webpack_require__(/*! ./Errors */ "./node_modules/antlr4/error/Errors.js").LexerNoViableAltException;
  32767. exports.InputMismatchException = __webpack_require__(/*! ./Errors */ "./node_modules/antlr4/error/Errors.js").InputMismatchException;
  32768. exports.FailedPredicateException = __webpack_require__(/*! ./Errors */ "./node_modules/antlr4/error/Errors.js").FailedPredicateException;
  32769. exports.DiagnosticErrorListener = __webpack_require__(/*! ./DiagnosticErrorListener */ "./node_modules/antlr4/error/DiagnosticErrorListener.js").DiagnosticErrorListener;
  32770. exports.BailErrorStrategy = __webpack_require__(/*! ./ErrorStrategy */ "./node_modules/antlr4/error/ErrorStrategy.js").BailErrorStrategy;
  32771. exports.ErrorListener = __webpack_require__(/*! ./ErrorListener */ "./node_modules/antlr4/error/ErrorListener.js").ErrorListener;
  32772. /***/ }),
  32773. /***/ "./node_modules/antlr4/index.js":
  32774. /*!**************************************!*\
  32775. !*** ./node_modules/antlr4/index.js ***!
  32776. \**************************************/
  32777. /*! no static exports found */
  32778. /***/ (function(module, exports, __webpack_require__) {
  32779. "use strict";
  32780. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  32781. * Use of this file is governed by the BSD 3-clause license that
  32782. * can be found in the LICENSE.txt file in the project root.
  32783. */
  32784. exports.atn = __webpack_require__(/*! ./atn/index */ "./node_modules/antlr4/atn/index.js");
  32785. exports.codepointat = __webpack_require__(/*! ./polyfills/codepointat */ "./node_modules/antlr4/polyfills/codepointat.js");
  32786. exports.dfa = __webpack_require__(/*! ./dfa/index */ "./node_modules/antlr4/dfa/index.js");
  32787. exports.fromcodepoint = __webpack_require__(/*! ./polyfills/fromcodepoint */ "./node_modules/antlr4/polyfills/fromcodepoint.js");
  32788. exports.tree = __webpack_require__(/*! ./tree/index */ "./node_modules/antlr4/tree/index.js");
  32789. exports.error = __webpack_require__(/*! ./error/index */ "./node_modules/antlr4/error/index.js");
  32790. exports.Token = __webpack_require__(/*! ./Token */ "./node_modules/antlr4/Token.js").Token;
  32791. exports.CharStreams = __webpack_require__(/*! ./CharStreams */ "./node_modules/antlr4/CharStreams.js").CharStreams;
  32792. exports.CommonToken = __webpack_require__(/*! ./Token */ "./node_modules/antlr4/Token.js").CommonToken;
  32793. exports.InputStream = __webpack_require__(/*! ./InputStream */ "./node_modules/antlr4/InputStream.js").InputStream;
  32794. exports.FileStream = __webpack_require__(/*! ./FileStream */ "./node_modules/antlr4/FileStream.js").FileStream;
  32795. exports.CommonTokenStream = __webpack_require__(/*! ./CommonTokenStream */ "./node_modules/antlr4/CommonTokenStream.js").CommonTokenStream;
  32796. exports.Lexer = __webpack_require__(/*! ./Lexer */ "./node_modules/antlr4/Lexer.js").Lexer;
  32797. exports.Parser = __webpack_require__(/*! ./Parser */ "./node_modules/antlr4/Parser.js").Parser;
  32798. var pc = __webpack_require__(/*! ./PredictionContext */ "./node_modules/antlr4/PredictionContext.js");
  32799. exports.PredictionContextCache = pc.PredictionContextCache;
  32800. exports.ParserRuleContext = __webpack_require__(/*! ./ParserRuleContext */ "./node_modules/antlr4/ParserRuleContext.js").ParserRuleContext;
  32801. exports.Interval = __webpack_require__(/*! ./IntervalSet */ "./node_modules/antlr4/IntervalSet.js").Interval;
  32802. exports.Utils = __webpack_require__(/*! ./Utils */ "./node_modules/antlr4/Utils.js");
  32803. /***/ }),
  32804. /***/ "./node_modules/antlr4/polyfills/codepointat.js":
  32805. /*!******************************************************!*\
  32806. !*** ./node_modules/antlr4/polyfills/codepointat.js ***!
  32807. \******************************************************/
  32808. /*! no static exports found */
  32809. /***/ (function(module, exports, __webpack_require__) {
  32810. "use strict";
  32811. /*! https://mths.be/codepointat v0.2.0 by @mathias */
  32812. if (!String.prototype.codePointAt) {
  32813. (function () {
  32814. 'use strict'; // needed to support `apply`/`call` with `undefined`/`null`
  32815. var defineProperty = function () {
  32816. // IE 8 only supports `Object.defineProperty` on DOM elements
  32817. try {
  32818. var object = {};
  32819. var $defineProperty = Object.defineProperty;
  32820. var result = $defineProperty(object, object, object) && $defineProperty;
  32821. } catch (error) {}
  32822. return result;
  32823. }();
  32824. var codePointAt = function codePointAt(position) {
  32825. if (this == null) {
  32826. throw TypeError();
  32827. }
  32828. var string = String(this);
  32829. var size = string.length;
  32830. // `ToInteger`
  32831. var index = position ? Number(position) : 0;
  32832. if (index != index) {
  32833. // better `isNaN`
  32834. index = 0;
  32835. }
  32836. // Account for out-of-bounds indices:
  32837. if (index < 0 || index >= size) {
  32838. return undefined;
  32839. }
  32840. // Get the first code unit
  32841. var first = string.charCodeAt(index);
  32842. var second;
  32843. if ( // check if it’s the start of a surrogate pair
  32844. first >= 0xD800 && first <= 0xDBFF && // high surrogate
  32845. size > index + 1 // there is a next code unit
  32846. ) {
  32847. second = string.charCodeAt(index + 1);
  32848. if (second >= 0xDC00 && second <= 0xDFFF) {
  32849. // low surrogate
  32850. // https://mathiasbynens.be/notes/javascript-encoding#surrogate-formulae
  32851. return (first - 0xD800) * 0x400 + second - 0xDC00 + 0x10000;
  32852. }
  32853. }
  32854. return first;
  32855. };
  32856. if (defineProperty) {
  32857. defineProperty(String.prototype, 'codePointAt', {
  32858. 'value': codePointAt,
  32859. 'configurable': true,
  32860. 'writable': true
  32861. });
  32862. } else {
  32863. String.prototype.codePointAt = codePointAt;
  32864. }
  32865. })();
  32866. }
  32867. /***/ }),
  32868. /***/ "./node_modules/antlr4/polyfills/fromcodepoint.js":
  32869. /*!********************************************************!*\
  32870. !*** ./node_modules/antlr4/polyfills/fromcodepoint.js ***!
  32871. \********************************************************/
  32872. /*! no static exports found */
  32873. /***/ (function(module, exports, __webpack_require__) {
  32874. "use strict";
  32875. /*! https://mths.be/fromcodepoint v0.2.1 by @mathias */
  32876. if (!String.fromCodePoint) {
  32877. (function () {
  32878. var defineProperty = function () {
  32879. // IE 8 only supports `Object.defineProperty` on DOM elements
  32880. try {
  32881. var object = {};
  32882. var $defineProperty = Object.defineProperty;
  32883. var result = $defineProperty(object, object, object) && $defineProperty;
  32884. } catch (error) {}
  32885. return result;
  32886. }();
  32887. var stringFromCharCode = String.fromCharCode;
  32888. var floor = Math.floor;
  32889. var fromCodePoint = function fromCodePoint(_) {
  32890. var MAX_SIZE = 0x4000;
  32891. var codeUnits = [];
  32892. var highSurrogate;
  32893. var lowSurrogate;
  32894. var index = -1;
  32895. var length = arguments.length;
  32896. if (!length) {
  32897. return '';
  32898. }
  32899. var result = '';
  32900. while (++index < length) {
  32901. var codePoint = Number(arguments[index]);
  32902. if (!isFinite(codePoint) || // `NaN`, `+Infinity`, or `-Infinity`
  32903. codePoint < 0 || // not a valid Unicode code point
  32904. codePoint > 0x10FFFF || // not a valid Unicode code point
  32905. floor(codePoint) != codePoint // not an integer
  32906. ) {
  32907. throw RangeError('Invalid code point: ' + codePoint);
  32908. }
  32909. if (codePoint <= 0xFFFF) {
  32910. // BMP code point
  32911. codeUnits.push(codePoint);
  32912. } else {
  32913. // Astral code point; split in surrogate halves
  32914. // https://mathiasbynens.be/notes/javascript-encoding#surrogate-formulae
  32915. codePoint -= 0x10000;
  32916. highSurrogate = (codePoint >> 10) + 0xD800;
  32917. lowSurrogate = codePoint % 0x400 + 0xDC00;
  32918. codeUnits.push(highSurrogate, lowSurrogate);
  32919. }
  32920. if (index + 1 == length || codeUnits.length > MAX_SIZE) {
  32921. result += stringFromCharCode.apply(null, codeUnits);
  32922. codeUnits.length = 0;
  32923. }
  32924. }
  32925. return result;
  32926. };
  32927. if (defineProperty) {
  32928. defineProperty(String, 'fromCodePoint', {
  32929. 'value': fromCodePoint,
  32930. 'configurable': true,
  32931. 'writable': true
  32932. });
  32933. } else {
  32934. String.fromCodePoint = fromCodePoint;
  32935. }
  32936. })();
  32937. }
  32938. /***/ }),
  32939. /***/ "./node_modules/antlr4/tree/Tree.js":
  32940. /*!******************************************!*\
  32941. !*** ./node_modules/antlr4/tree/Tree.js ***!
  32942. \******************************************/
  32943. /*! no static exports found */
  32944. /***/ (function(module, exports, __webpack_require__) {
  32945. "use strict";
  32946. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  32947. * Use of this file is governed by the BSD 3-clause license that
  32948. * can be found in the LICENSE.txt file in the project root.
  32949. */
  32950. ///
  32951. // The basic notion of a tree has a parent, a payload, and a list of children.
  32952. // It is the most abstract interface for all the trees used by ANTLR.
  32953. ///
  32954. var Token = __webpack_require__(/*! ./../Token */ "./node_modules/antlr4/Token.js").Token;
  32955. var Interval = __webpack_require__(/*! ./../IntervalSet */ "./node_modules/antlr4/IntervalSet.js").Interval;
  32956. var INVALID_INTERVAL = new Interval(-1, -2);
  32957. var Utils = __webpack_require__(/*! ../Utils.js */ "./node_modules/antlr4/Utils.js");
  32958. function Tree() {
  32959. return this;
  32960. }
  32961. function SyntaxTree() {
  32962. Tree.call(this);
  32963. return this;
  32964. }
  32965. SyntaxTree.prototype = Object.create(Tree.prototype);
  32966. SyntaxTree.prototype.constructor = SyntaxTree;
  32967. function ParseTree() {
  32968. SyntaxTree.call(this);
  32969. return this;
  32970. }
  32971. ParseTree.prototype = Object.create(SyntaxTree.prototype);
  32972. ParseTree.prototype.constructor = ParseTree;
  32973. function RuleNode() {
  32974. ParseTree.call(this);
  32975. return this;
  32976. }
  32977. RuleNode.prototype = Object.create(ParseTree.prototype);
  32978. RuleNode.prototype.constructor = RuleNode;
  32979. function TerminalNode() {
  32980. ParseTree.call(this);
  32981. return this;
  32982. }
  32983. TerminalNode.prototype = Object.create(ParseTree.prototype);
  32984. TerminalNode.prototype.constructor = TerminalNode;
  32985. function ErrorNode() {
  32986. TerminalNode.call(this);
  32987. return this;
  32988. }
  32989. ErrorNode.prototype = Object.create(TerminalNode.prototype);
  32990. ErrorNode.prototype.constructor = ErrorNode;
  32991. function ParseTreeVisitor() {
  32992. return this;
  32993. }
  32994. ParseTreeVisitor.prototype.visit = function (ctx) {
  32995. if (Array.isArray(ctx)) {
  32996. return ctx.map(function (child) {
  32997. return child.accept(this);
  32998. }, this);
  32999. } else {
  33000. return ctx.accept(this);
  33001. }
  33002. };
  33003. ParseTreeVisitor.prototype.visitChildren = function (ctx) {
  33004. return this.visit(ctx.children);
  33005. };
  33006. ParseTreeVisitor.prototype.visitTerminal = function (node) {};
  33007. ParseTreeVisitor.prototype.visitErrorNode = function (node) {};
  33008. function ParseTreeListener() {
  33009. return this;
  33010. }
  33011. ParseTreeListener.prototype.visitTerminal = function (node) {};
  33012. ParseTreeListener.prototype.visitErrorNode = function (node) {};
  33013. ParseTreeListener.prototype.enterEveryRule = function (node) {};
  33014. ParseTreeListener.prototype.exitEveryRule = function (node) {};
  33015. function TerminalNodeImpl(symbol) {
  33016. TerminalNode.call(this);
  33017. this.parentCtx = null;
  33018. this.symbol = symbol;
  33019. return this;
  33020. }
  33021. TerminalNodeImpl.prototype = Object.create(TerminalNode.prototype);
  33022. TerminalNodeImpl.prototype.constructor = TerminalNodeImpl;
  33023. TerminalNodeImpl.prototype.getChild = function (i) {
  33024. return null;
  33025. };
  33026. TerminalNodeImpl.prototype.getSymbol = function () {
  33027. return this.symbol;
  33028. };
  33029. TerminalNodeImpl.prototype.getParent = function () {
  33030. return this.parentCtx;
  33031. };
  33032. TerminalNodeImpl.prototype.getPayload = function () {
  33033. return this.symbol;
  33034. };
  33035. TerminalNodeImpl.prototype.getSourceInterval = function () {
  33036. if (this.symbol === null) {
  33037. return INVALID_INTERVAL;
  33038. }
  33039. var tokenIndex = this.symbol.tokenIndex;
  33040. return new Interval(tokenIndex, tokenIndex);
  33041. };
  33042. TerminalNodeImpl.prototype.getChildCount = function () {
  33043. return 0;
  33044. };
  33045. TerminalNodeImpl.prototype.accept = function (visitor) {
  33046. return visitor.visitTerminal(this);
  33047. };
  33048. TerminalNodeImpl.prototype.getText = function () {
  33049. return this.symbol.text;
  33050. };
  33051. TerminalNodeImpl.prototype.toString = function () {
  33052. if (this.symbol.type === Token.EOF) {
  33053. return "<EOF>";
  33054. } else {
  33055. return this.symbol.text;
  33056. }
  33057. };
  33058. // Represents a token that was consumed during resynchronization
  33059. // rather than during a valid match operation. For example,
  33060. // we will create this kind of a node during single token insertion
  33061. // and deletion as well as during "consume until error recovery set"
  33062. // upon no viable alternative exceptions.
  33063. function ErrorNodeImpl(token) {
  33064. TerminalNodeImpl.call(this, token);
  33065. return this;
  33066. }
  33067. ErrorNodeImpl.prototype = Object.create(TerminalNodeImpl.prototype);
  33068. ErrorNodeImpl.prototype.constructor = ErrorNodeImpl;
  33069. ErrorNodeImpl.prototype.isErrorNode = function () {
  33070. return true;
  33071. };
  33072. ErrorNodeImpl.prototype.accept = function (visitor) {
  33073. return visitor.visitErrorNode(this);
  33074. };
  33075. function ParseTreeWalker() {
  33076. return this;
  33077. }
  33078. ParseTreeWalker.prototype.walk = function (listener, t) {
  33079. var errorNode = t instanceof ErrorNode || t.isErrorNode !== undefined && t.isErrorNode();
  33080. if (errorNode) {
  33081. listener.visitErrorNode(t);
  33082. } else if (t instanceof TerminalNode) {
  33083. listener.visitTerminal(t);
  33084. } else {
  33085. this.enterRule(listener, t);
  33086. for (var i = 0; i < t.getChildCount(); i++) {
  33087. var child = t.getChild(i);
  33088. this.walk(listener, child);
  33089. }
  33090. this.exitRule(listener, t);
  33091. }
  33092. };
  33093. //
  33094. // The discovery of a rule node, involves sending two events: the generic
  33095. // {@link ParseTreeListener//enterEveryRule} and a
  33096. // {@link RuleContext}-specific event. First we trigger the generic and then
  33097. // the rule specific. We to them in reverse order upon finishing the node.
  33098. //
  33099. ParseTreeWalker.prototype.enterRule = function (listener, r) {
  33100. var ctx = r.getRuleContext();
  33101. listener.enterEveryRule(ctx);
  33102. ctx.enterRule(listener);
  33103. };
  33104. ParseTreeWalker.prototype.exitRule = function (listener, r) {
  33105. var ctx = r.getRuleContext();
  33106. ctx.exitRule(listener);
  33107. listener.exitEveryRule(ctx);
  33108. };
  33109. ParseTreeWalker.DEFAULT = new ParseTreeWalker();
  33110. exports.RuleNode = RuleNode;
  33111. exports.ErrorNode = ErrorNode;
  33112. exports.TerminalNode = TerminalNode;
  33113. exports.ErrorNodeImpl = ErrorNodeImpl;
  33114. exports.TerminalNodeImpl = TerminalNodeImpl;
  33115. exports.ParseTreeListener = ParseTreeListener;
  33116. exports.ParseTreeVisitor = ParseTreeVisitor;
  33117. exports.ParseTreeWalker = ParseTreeWalker;
  33118. exports.INVALID_INTERVAL = INVALID_INTERVAL;
  33119. /***/ }),
  33120. /***/ "./node_modules/antlr4/tree/Trees.js":
  33121. /*!*******************************************!*\
  33122. !*** ./node_modules/antlr4/tree/Trees.js ***!
  33123. \*******************************************/
  33124. /*! no static exports found */
  33125. /***/ (function(module, exports, __webpack_require__) {
  33126. "use strict";
  33127. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  33128. * Use of this file is governed by the BSD 3-clause license that
  33129. * can be found in the LICENSE.txt file in the project root.
  33130. */
  33131. var Utils = __webpack_require__(/*! ./../Utils */ "./node_modules/antlr4/Utils.js");
  33132. var Token = __webpack_require__(/*! ./../Token */ "./node_modules/antlr4/Token.js").Token;
  33133. var RuleNode = __webpack_require__(/*! ./Tree */ "./node_modules/antlr4/tree/Tree.js").RuleNode;
  33134. var ErrorNode = __webpack_require__(/*! ./Tree */ "./node_modules/antlr4/tree/Tree.js").ErrorNode;
  33135. var TerminalNode = __webpack_require__(/*! ./Tree */ "./node_modules/antlr4/tree/Tree.js").TerminalNode;
  33136. var ParserRuleContext = __webpack_require__(/*! ./../ParserRuleContext */ "./node_modules/antlr4/ParserRuleContext.js").ParserRuleContext;
  33137. var RuleContext = __webpack_require__(/*! ./../RuleContext */ "./node_modules/antlr4/RuleContext.js").RuleContext;
  33138. var INVALID_ALT_NUMBER = __webpack_require__(/*! ./../atn/ATN */ "./node_modules/antlr4/atn/ATN.js").INVALID_ALT_NUMBER;
  33139. /** A set of utility routines useful for all kinds of ANTLR trees. */
  33140. function Trees() {}
  33141. // Print out a whole tree in LISP form. {@link //getNodeText} is used on the
  33142. // node payloads to get the text for the nodes. Detect
  33143. // parse trees and extract data appropriately.
  33144. Trees.toStringTree = function (tree, ruleNames, recog) {
  33145. ruleNames = ruleNames || null;
  33146. recog = recog || null;
  33147. if (recog !== null) {
  33148. ruleNames = recog.ruleNames;
  33149. }
  33150. var s = Trees.getNodeText(tree, ruleNames);
  33151. s = Utils.escapeWhitespace(s, false);
  33152. var c = tree.getChildCount();
  33153. if (c === 0) {
  33154. return s;
  33155. }
  33156. var res = "(" + s + ' ';
  33157. if (c > 0) {
  33158. s = Trees.toStringTree(tree.getChild(0), ruleNames);
  33159. res = res.concat(s);
  33160. }
  33161. for (var i = 1; i < c; i++) {
  33162. s = Trees.toStringTree(tree.getChild(i), ruleNames);
  33163. res = res.concat(' ' + s);
  33164. }
  33165. res = res.concat(")");
  33166. return res;
  33167. };
  33168. Trees.getNodeText = function (t, ruleNames, recog) {
  33169. ruleNames = ruleNames || null;
  33170. recog = recog || null;
  33171. if (recog !== null) {
  33172. ruleNames = recog.ruleNames;
  33173. }
  33174. if (ruleNames !== null) {
  33175. if (t instanceof RuleContext) {
  33176. var altNumber = t.getAltNumber();
  33177. if (altNumber != INVALID_ALT_NUMBER) {
  33178. return ruleNames[t.ruleIndex] + ":" + altNumber;
  33179. }
  33180. return ruleNames[t.ruleIndex];
  33181. } else if (t instanceof ErrorNode) {
  33182. return t.toString();
  33183. } else if (t instanceof TerminalNode) {
  33184. if (t.symbol !== null) {
  33185. return t.symbol.text;
  33186. }
  33187. }
  33188. }
  33189. // no recog for rule names
  33190. var payload = t.getPayload();
  33191. if (payload instanceof Token) {
  33192. return payload.text;
  33193. }
  33194. return t.getPayload().toString();
  33195. };
  33196. // Return ordered list of all children of this node
  33197. Trees.getChildren = function (t) {
  33198. var list = [];
  33199. for (var i = 0; i < t.getChildCount(); i++) {
  33200. list.push(t.getChild(i));
  33201. }
  33202. return list;
  33203. };
  33204. // Return a list of all ancestors of this node. The first node of
  33205. // list is the root and the last is the parent of this node.
  33206. //
  33207. Trees.getAncestors = function (t) {
  33208. var ancestors = [];
  33209. t = t.getParent();
  33210. while (t !== null) {
  33211. ancestors = [t].concat(ancestors);
  33212. t = t.getParent();
  33213. }
  33214. return ancestors;
  33215. };
  33216. Trees.findAllTokenNodes = function (t, ttype) {
  33217. return Trees.findAllNodes(t, ttype, true);
  33218. };
  33219. Trees.findAllRuleNodes = function (t, ruleIndex) {
  33220. return Trees.findAllNodes(t, ruleIndex, false);
  33221. };
  33222. Trees.findAllNodes = function (t, index, findTokens) {
  33223. var nodes = [];
  33224. Trees._findAllNodes(t, index, findTokens, nodes);
  33225. return nodes;
  33226. };
  33227. Trees._findAllNodes = function (t, index, findTokens, nodes) {
  33228. // check this node (the root) first
  33229. if (findTokens && t instanceof TerminalNode) {
  33230. if (t.symbol.type === index) {
  33231. nodes.push(t);
  33232. }
  33233. } else if (!findTokens && t instanceof ParserRuleContext) {
  33234. if (t.ruleIndex === index) {
  33235. nodes.push(t);
  33236. }
  33237. }
  33238. // check children
  33239. for (var i = 0; i < t.getChildCount(); i++) {
  33240. Trees._findAllNodes(t.getChild(i), index, findTokens, nodes);
  33241. }
  33242. };
  33243. Trees.descendants = function (t) {
  33244. var nodes = [t];
  33245. for (var i = 0; i < t.getChildCount(); i++) {
  33246. nodes = nodes.concat(Trees.descendants(t.getChild(i)));
  33247. }
  33248. return nodes;
  33249. };
  33250. exports.Trees = Trees;
  33251. /***/ }),
  33252. /***/ "./node_modules/antlr4/tree/index.js":
  33253. /*!*******************************************!*\
  33254. !*** ./node_modules/antlr4/tree/index.js ***!
  33255. \*******************************************/
  33256. /*! no static exports found */
  33257. /***/ (function(module, exports, __webpack_require__) {
  33258. "use strict";
  33259. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  33260. * Use of this file is governed by the BSD 3-clause license that
  33261. * can be found in the LICENSE.txt file in the project root.
  33262. */
  33263. var Tree = __webpack_require__(/*! ./Tree */ "./node_modules/antlr4/tree/Tree.js");
  33264. exports.Trees = __webpack_require__(/*! ./Trees */ "./node_modules/antlr4/tree/Trees.js").Trees;
  33265. exports.RuleNode = Tree.RuleNode;
  33266. exports.ParseTreeListener = Tree.ParseTreeListener;
  33267. exports.ParseTreeVisitor = Tree.ParseTreeVisitor;
  33268. exports.ParseTreeWalker = Tree.ParseTreeWalker;
  33269. /***/ }),
  33270. /***/ "./node_modules/decimal.js/decimal.js":
  33271. /*!********************************************!*\
  33272. !*** ./node_modules/decimal.js/decimal.js ***!
  33273. \********************************************/
  33274. /*! no static exports found */
  33275. /***/ (function(module, exports, __webpack_require__) {
  33276. "use strict";
  33277. var __WEBPACK_AMD_DEFINE_RESULT__;
  33278. 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; };
  33279. /*! decimal.js v10.0.1 https://github.com/MikeMcl/decimal.js/LICENCE */
  33280. ;(function (globalScope) {
  33281. 'use strict';
  33282. /*
  33283. * decimal.js v10.0.1
  33284. * An arbitrary-precision Decimal type for JavaScript.
  33285. * https://github.com/MikeMcl/decimal.js
  33286. * Copyright (c) 2017 Michael Mclaughlin <M8ch88l@gmail.com>
  33287. * MIT Licence
  33288. */
  33289. // ----------------------------------- EDITABLE DEFAULTS ------------------------------------ //
  33290. // The maximum exponent magnitude.
  33291. // The limit on the value of `toExpNeg`, `toExpPos`, `minE` and `maxE`.
  33292. var EXP_LIMIT = 9e15,
  33293. // 0 to 9e15
  33294. // The limit on the value of `precision`, and on the value of the first argument to
  33295. // `toDecimalPlaces`, `toExponential`, `toFixed`, `toPrecision` and `toSignificantDigits`.
  33296. MAX_DIGITS = 1e9,
  33297. // 0 to 1e9
  33298. // Base conversion alphabet.
  33299. NUMERALS = '0123456789abcdef',
  33300. // The natural logarithm of 10 (1025 digits).
  33301. LN10 = '2.3025850929940456840179914546843642076011014886287729760333279009675726096773524802359972050895982983419677840422862486334095254650828067566662873690987816894829072083255546808437998948262331985283935053089653777326288461633662222876982198867465436674744042432743651550489343149393914796194044002221051017141748003688084012647080685567743216228355220114804663715659121373450747856947683463616792101806445070648000277502684916746550586856935673420670581136429224554405758925724208241314695689016758940256776311356919292033376587141660230105703089634572075440370847469940168269282808481184289314848524948644871927809676271275775397027668605952496716674183485704422507197965004714951050492214776567636938662976979522110718264549734772662425709429322582798502585509785265383207606726317164309505995087807523710333101197857547331541421808427543863591778117054309827482385045648019095610299291824318237525357709750539565187697510374970888692180205189339507238539205144634197265287286965110862571492198849978748873771345686209167058',
  33302. // Pi (1025 digits).
  33303. PI = '3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989380952572010654858632789',
  33304. // The initial configuration properties of the Decimal constructor.
  33305. DEFAULTS = {
  33306. // These values must be integers within the stated ranges (inclusive).
  33307. // Most of these values can be changed at run-time using the `Decimal.config` method.
  33308. // The maximum number of significant digits of the result of a calculation or base conversion.
  33309. // E.g. `Decimal.config({ precision: 20 });`
  33310. precision: 20, // 1 to MAX_DIGITS
  33311. // The rounding mode used when rounding to `precision`.
  33312. //
  33313. // ROUND_UP 0 Away from zero.
  33314. // ROUND_DOWN 1 Towards zero.
  33315. // ROUND_CEIL 2 Towards +Infinity.
  33316. // ROUND_FLOOR 3 Towards -Infinity.
  33317. // ROUND_HALF_UP 4 Towards nearest neighbour. If equidistant, up.
  33318. // ROUND_HALF_DOWN 5 Towards nearest neighbour. If equidistant, down.
  33319. // ROUND_HALF_EVEN 6 Towards nearest neighbour. If equidistant, towards even neighbour.
  33320. // ROUND_HALF_CEIL 7 Towards nearest neighbour. If equidistant, towards +Infinity.
  33321. // ROUND_HALF_FLOOR 8 Towards nearest neighbour. If equidistant, towards -Infinity.
  33322. //
  33323. // E.g.
  33324. // `Decimal.rounding = 4;`
  33325. // `Decimal.rounding = Decimal.ROUND_HALF_UP;`
  33326. rounding: 4, // 0 to 8
  33327. // The modulo mode used when calculating the modulus: a mod n.
  33328. // The quotient (q = a / n) is calculated according to the corresponding rounding mode.
  33329. // The remainder (r) is calculated as: r = a - n * q.
  33330. //
  33331. // UP 0 The remainder is positive if the dividend is negative, else is negative.
  33332. // DOWN 1 The remainder has the same sign as the dividend (JavaScript %).
  33333. // FLOOR 3 The remainder has the same sign as the divisor (Python %).
  33334. // HALF_EVEN 6 The IEEE 754 remainder function.
  33335. // EUCLID 9 Euclidian division. q = sign(n) * floor(a / abs(n)). Always positive.
  33336. //
  33337. // Truncated division (1), floored division (3), the IEEE 754 remainder (6), and Euclidian
  33338. // division (9) are commonly used for the modulus operation. The other rounding modes can also
  33339. // be used, but they may not give useful results.
  33340. modulo: 1, // 0 to 9
  33341. // The exponent value at and beneath which `toString` returns exponential notation.
  33342. // JavaScript numbers: -7
  33343. toExpNeg: -7, // 0 to -EXP_LIMIT
  33344. // The exponent value at and above which `toString` returns exponential notation.
  33345. // JavaScript numbers: 21
  33346. toExpPos: 21, // 0 to EXP_LIMIT
  33347. // The minimum exponent value, beneath which underflow to zero occurs.
  33348. // JavaScript numbers: -324 (5e-324)
  33349. minE: -EXP_LIMIT, // -1 to -EXP_LIMIT
  33350. // The maximum exponent value, above which overflow to Infinity occurs.
  33351. // JavaScript numbers: 308 (1.7976931348623157e+308)
  33352. maxE: EXP_LIMIT, // 1 to EXP_LIMIT
  33353. // Whether to use cryptographically-secure random number generation, if available.
  33354. crypto: false // true/false
  33355. },
  33356. // ----------------------------------- END OF EDITABLE DEFAULTS ------------------------------- //
  33357. Decimal,
  33358. inexact,
  33359. noConflict,
  33360. quadrant,
  33361. external = true,
  33362. decimalError = '[DecimalError] ',
  33363. invalidArgument = decimalError + 'Invalid argument: ',
  33364. precisionLimitExceeded = decimalError + 'Precision limit exceeded',
  33365. cryptoUnavailable = decimalError + 'crypto unavailable',
  33366. mathfloor = Math.floor,
  33367. mathpow = Math.pow,
  33368. isBinary = /^0b([01]+(\.[01]*)?|\.[01]+)(p[+-]?\d+)?$/i,
  33369. isHex = /^0x([0-9a-f]+(\.[0-9a-f]*)?|\.[0-9a-f]+)(p[+-]?\d+)?$/i,
  33370. isOctal = /^0o([0-7]+(\.[0-7]*)?|\.[0-7]+)(p[+-]?\d+)?$/i,
  33371. isDecimal = /^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,
  33372. BASE = 1e7,
  33373. LOG_BASE = 7,
  33374. MAX_SAFE_INTEGER = 9007199254740991,
  33375. LN10_PRECISION = LN10.length - 1,
  33376. PI_PRECISION = PI.length - 1,
  33377. // Decimal.prototype object
  33378. P = { name: '[object Decimal]' };
  33379. // Decimal prototype methods
  33380. /*
  33381. * absoluteValue abs
  33382. * ceil
  33383. * comparedTo cmp
  33384. * cosine cos
  33385. * cubeRoot cbrt
  33386. * decimalPlaces dp
  33387. * dividedBy div
  33388. * dividedToIntegerBy divToInt
  33389. * equals eq
  33390. * floor
  33391. * greaterThan gt
  33392. * greaterThanOrEqualTo gte
  33393. * hyperbolicCosine cosh
  33394. * hyperbolicSine sinh
  33395. * hyperbolicTangent tanh
  33396. * inverseCosine acos
  33397. * inverseHyperbolicCosine acosh
  33398. * inverseHyperbolicSine asinh
  33399. * inverseHyperbolicTangent atanh
  33400. * inverseSine asin
  33401. * inverseTangent atan
  33402. * isFinite
  33403. * isInteger isInt
  33404. * isNaN
  33405. * isNegative isNeg
  33406. * isPositive isPos
  33407. * isZero
  33408. * lessThan lt
  33409. * lessThanOrEqualTo lte
  33410. * logarithm log
  33411. * [maximum] [max]
  33412. * [minimum] [min]
  33413. * minus sub
  33414. * modulo mod
  33415. * naturalExponential exp
  33416. * naturalLogarithm ln
  33417. * negated neg
  33418. * plus add
  33419. * precision sd
  33420. * round
  33421. * sine sin
  33422. * squareRoot sqrt
  33423. * tangent tan
  33424. * times mul
  33425. * toBinary
  33426. * toDecimalPlaces toDP
  33427. * toExponential
  33428. * toFixed
  33429. * toFraction
  33430. * toHexadecimal toHex
  33431. * toNearest
  33432. * toNumber
  33433. * toOctal
  33434. * toPower pow
  33435. * toPrecision
  33436. * toSignificantDigits toSD
  33437. * toString
  33438. * truncated trunc
  33439. * valueOf toJSON
  33440. */
  33441. /*
  33442. * Return a new Decimal whose value is the absolute value of this Decimal.
  33443. *
  33444. */
  33445. P.absoluteValue = P.abs = function () {
  33446. var x = new this.constructor(this);
  33447. if (x.s < 0) x.s = 1;
  33448. return finalise(x);
  33449. };
  33450. /*
  33451. * Return a new Decimal whose value is the value of this Decimal rounded to a whole number in the
  33452. * direction of positive Infinity.
  33453. *
  33454. */
  33455. P.ceil = function () {
  33456. return finalise(new this.constructor(this), this.e + 1, 2);
  33457. };
  33458. /*
  33459. * Return
  33460. * 1 if the value of this Decimal is greater than the value of `y`,
  33461. * -1 if the value of this Decimal is less than the value of `y`,
  33462. * 0 if they have the same value,
  33463. * NaN if the value of either Decimal is NaN.
  33464. *
  33465. */
  33466. P.comparedTo = P.cmp = function (y) {
  33467. var i,
  33468. j,
  33469. xdL,
  33470. ydL,
  33471. x = this,
  33472. xd = x.d,
  33473. yd = (y = new x.constructor(y)).d,
  33474. xs = x.s,
  33475. ys = y.s;
  33476. // Either NaN or ±Infinity?
  33477. if (!xd || !yd) {
  33478. return !xs || !ys ? NaN : xs !== ys ? xs : xd === yd ? 0 : !xd ^ xs < 0 ? 1 : -1;
  33479. }
  33480. // Either zero?
  33481. if (!xd[0] || !yd[0]) return xd[0] ? xs : yd[0] ? -ys : 0;
  33482. // Signs differ?
  33483. if (xs !== ys) return xs;
  33484. // Compare exponents.
  33485. if (x.e !== y.e) return x.e > y.e ^ xs < 0 ? 1 : -1;
  33486. xdL = xd.length;
  33487. ydL = yd.length;
  33488. // Compare digit by digit.
  33489. for (i = 0, j = xdL < ydL ? xdL : ydL; i < j; ++i) {
  33490. if (xd[i] !== yd[i]) return xd[i] > yd[i] ^ xs < 0 ? 1 : -1;
  33491. }
  33492. // Compare lengths.
  33493. return xdL === ydL ? 0 : xdL > ydL ^ xs < 0 ? 1 : -1;
  33494. };
  33495. /*
  33496. * Return a new Decimal whose value is the cosine of the value in radians of this Decimal.
  33497. *
  33498. * Domain: [-Infinity, Infinity]
  33499. * Range: [-1, 1]
  33500. *
  33501. * cos(0) = 1
  33502. * cos(-0) = 1
  33503. * cos(Infinity) = NaN
  33504. * cos(-Infinity) = NaN
  33505. * cos(NaN) = NaN
  33506. *
  33507. */
  33508. P.cosine = P.cos = function () {
  33509. var pr,
  33510. rm,
  33511. x = this,
  33512. Ctor = x.constructor;
  33513. if (!x.d) return new Ctor(NaN);
  33514. // cos(0) = cos(-0) = 1
  33515. if (!x.d[0]) return new Ctor(1);
  33516. pr = Ctor.precision;
  33517. rm = Ctor.rounding;
  33518. Ctor.precision = pr + Math.max(x.e, x.sd()) + LOG_BASE;
  33519. Ctor.rounding = 1;
  33520. x = cosine(Ctor, toLessThanHalfPi(Ctor, x));
  33521. Ctor.precision = pr;
  33522. Ctor.rounding = rm;
  33523. return finalise(quadrant == 2 || quadrant == 3 ? x.neg() : x, pr, rm, true);
  33524. };
  33525. /*
  33526. *
  33527. * Return a new Decimal whose value is the cube root of the value of this Decimal, rounded to
  33528. * `precision` significant digits using rounding mode `rounding`.
  33529. *
  33530. * cbrt(0) = 0
  33531. * cbrt(-0) = -0
  33532. * cbrt(1) = 1
  33533. * cbrt(-1) = -1
  33534. * cbrt(N) = N
  33535. * cbrt(-I) = -I
  33536. * cbrt(I) = I
  33537. *
  33538. * Math.cbrt(x) = (x < 0 ? -Math.pow(-x, 1/3) : Math.pow(x, 1/3))
  33539. *
  33540. */
  33541. P.cubeRoot = P.cbrt = function () {
  33542. var e,
  33543. m,
  33544. n,
  33545. r,
  33546. rep,
  33547. s,
  33548. sd,
  33549. t,
  33550. t3,
  33551. t3plusx,
  33552. x = this,
  33553. Ctor = x.constructor;
  33554. if (!x.isFinite() || x.isZero()) return new Ctor(x);
  33555. external = false;
  33556. // Initial estimate.
  33557. s = x.s * Math.pow(x.s * x, 1 / 3);
  33558. // Math.cbrt underflow/overflow?
  33559. // Pass x to Math.pow as integer, then adjust the exponent of the result.
  33560. if (!s || Math.abs(s) == 1 / 0) {
  33561. n = digitsToString(x.d);
  33562. e = x.e;
  33563. // Adjust n exponent so it is a multiple of 3 away from x exponent.
  33564. if (s = (e - n.length + 1) % 3) n += s == 1 || s == -2 ? '0' : '00';
  33565. s = Math.pow(n, 1 / 3);
  33566. // Rarely, e may be one less than the result exponent value.
  33567. e = mathfloor((e + 1) / 3) - (e % 3 == (e < 0 ? -1 : 2));
  33568. if (s == 1 / 0) {
  33569. n = '5e' + e;
  33570. } else {
  33571. n = s.toExponential();
  33572. n = n.slice(0, n.indexOf('e') + 1) + e;
  33573. }
  33574. r = new Ctor(n);
  33575. r.s = x.s;
  33576. } else {
  33577. r = new Ctor(s.toString());
  33578. }
  33579. sd = (e = Ctor.precision) + 3;
  33580. // Halley's method.
  33581. // TODO? Compare Newton's method.
  33582. for (;;) {
  33583. t = r;
  33584. t3 = t.times(t).times(t);
  33585. t3plusx = t3.plus(x);
  33586. r = divide(t3plusx.plus(x).times(t), t3plusx.plus(t3), sd + 2, 1);
  33587. // TODO? Replace with for-loop and checkRoundingDigits.
  33588. if (digitsToString(t.d).slice(0, sd) === (n = digitsToString(r.d)).slice(0, sd)) {
  33589. n = n.slice(sd - 3, sd + 1);
  33590. // The 4th rounding digit may be in error by -1 so if the 4 rounding digits are 9999 or 4999
  33591. // , i.e. approaching a rounding boundary, continue the iteration.
  33592. if (n == '9999' || !rep && n == '4999') {
  33593. // On the first iteration only, check to see if rounding up gives the exact result as the
  33594. // nines may infinitely repeat.
  33595. if (!rep) {
  33596. finalise(t, e + 1, 0);
  33597. if (t.times(t).times(t).eq(x)) {
  33598. r = t;
  33599. break;
  33600. }
  33601. }
  33602. sd += 4;
  33603. rep = 1;
  33604. } else {
  33605. // If the rounding digits are null, 0{0,4} or 50{0,3}, check for an exact result.
  33606. // If not, then there are further digits and m will be truthy.
  33607. if (!+n || !+n.slice(1) && n.charAt(0) == '5') {
  33608. // Truncate to the first rounding digit.
  33609. finalise(r, e + 1, 1);
  33610. m = !r.times(r).times(r).eq(x);
  33611. }
  33612. break;
  33613. }
  33614. }
  33615. }
  33616. external = true;
  33617. return finalise(r, e, Ctor.rounding, m);
  33618. };
  33619. /*
  33620. * Return the number of decimal places of the value of this Decimal.
  33621. *
  33622. */
  33623. P.decimalPlaces = P.dp = function () {
  33624. var w,
  33625. d = this.d,
  33626. n = NaN;
  33627. if (d) {
  33628. w = d.length - 1;
  33629. n = (w - mathfloor(this.e / LOG_BASE)) * LOG_BASE;
  33630. // Subtract the number of trailing zeros of the last word.
  33631. w = d[w];
  33632. if (w) for (; w % 10 == 0; w /= 10) {
  33633. n--;
  33634. }if (n < 0) n = 0;
  33635. }
  33636. return n;
  33637. };
  33638. /*
  33639. * n / 0 = I
  33640. * n / N = N
  33641. * n / I = 0
  33642. * 0 / n = 0
  33643. * 0 / 0 = N
  33644. * 0 / N = N
  33645. * 0 / I = 0
  33646. * N / n = N
  33647. * N / 0 = N
  33648. * N / N = N
  33649. * N / I = N
  33650. * I / n = I
  33651. * I / 0 = I
  33652. * I / N = N
  33653. * I / I = N
  33654. *
  33655. * Return a new Decimal whose value is the value of this Decimal divided by `y`, rounded to
  33656. * `precision` significant digits using rounding mode `rounding`.
  33657. *
  33658. */
  33659. P.dividedBy = P.div = function (y) {
  33660. return divide(this, new this.constructor(y));
  33661. };
  33662. /*
  33663. * Return a new Decimal whose value is the integer part of dividing the value of this Decimal
  33664. * by the value of `y`, rounded to `precision` significant digits using rounding mode `rounding`.
  33665. *
  33666. */
  33667. P.dividedToIntegerBy = P.divToInt = function (y) {
  33668. var x = this,
  33669. Ctor = x.constructor;
  33670. return finalise(divide(x, new Ctor(y), 0, 1, 1), Ctor.precision, Ctor.rounding);
  33671. };
  33672. /*
  33673. * Return true if the value of this Decimal is equal to the value of `y`, otherwise return false.
  33674. *
  33675. */
  33676. P.equals = P.eq = function (y) {
  33677. return this.cmp(y) === 0;
  33678. };
  33679. /*
  33680. * Return a new Decimal whose value is the value of this Decimal rounded to a whole number in the
  33681. * direction of negative Infinity.
  33682. *
  33683. */
  33684. P.floor = function () {
  33685. return finalise(new this.constructor(this), this.e + 1, 3);
  33686. };
  33687. /*
  33688. * Return true if the value of this Decimal is greater than the value of `y`, otherwise return
  33689. * false.
  33690. *
  33691. */
  33692. P.greaterThan = P.gt = function (y) {
  33693. return this.cmp(y) > 0;
  33694. };
  33695. /*
  33696. * Return true if the value of this Decimal is greater than or equal to the value of `y`,
  33697. * otherwise return false.
  33698. *
  33699. */
  33700. P.greaterThanOrEqualTo = P.gte = function (y) {
  33701. var k = this.cmp(y);
  33702. return k == 1 || k === 0;
  33703. };
  33704. /*
  33705. * Return a new Decimal whose value is the hyperbolic cosine of the value in radians of this
  33706. * Decimal.
  33707. *
  33708. * Domain: [-Infinity, Infinity]
  33709. * Range: [1, Infinity]
  33710. *
  33711. * cosh(x) = 1 + x^2/2! + x^4/4! + x^6/6! + ...
  33712. *
  33713. * cosh(0) = 1
  33714. * cosh(-0) = 1
  33715. * cosh(Infinity) = Infinity
  33716. * cosh(-Infinity) = Infinity
  33717. * cosh(NaN) = NaN
  33718. *
  33719. * x time taken (ms) result
  33720. * 1000 9 9.8503555700852349694e+433
  33721. * 10000 25 4.4034091128314607936e+4342
  33722. * 100000 171 1.4033316802130615897e+43429
  33723. * 1000000 3817 1.5166076984010437725e+434294
  33724. * 10000000 abandoned after 2 minute wait
  33725. *
  33726. * TODO? Compare performance of cosh(x) = 0.5 * (exp(x) + exp(-x))
  33727. *
  33728. */
  33729. P.hyperbolicCosine = P.cosh = function () {
  33730. var k,
  33731. n,
  33732. pr,
  33733. rm,
  33734. len,
  33735. x = this,
  33736. Ctor = x.constructor,
  33737. one = new Ctor(1);
  33738. if (!x.isFinite()) return new Ctor(x.s ? 1 / 0 : NaN);
  33739. if (x.isZero()) return one;
  33740. pr = Ctor.precision;
  33741. rm = Ctor.rounding;
  33742. Ctor.precision = pr + Math.max(x.e, x.sd()) + 4;
  33743. Ctor.rounding = 1;
  33744. len = x.d.length;
  33745. // Argument reduction: cos(4x) = 1 - 8cos^2(x) + 8cos^4(x) + 1
  33746. // i.e. cos(x) = 1 - cos^2(x/4)(8 - 8cos^2(x/4))
  33747. // Estimate the optimum number of times to use the argument reduction.
  33748. // TODO? Estimation reused from cosine() and may not be optimal here.
  33749. if (len < 32) {
  33750. k = Math.ceil(len / 3);
  33751. n = Math.pow(4, -k).toString();
  33752. } else {
  33753. k = 16;
  33754. n = '2.3283064365386962890625e-10';
  33755. }
  33756. x = taylorSeries(Ctor, 1, x.times(n), new Ctor(1), true);
  33757. // Reverse argument reduction
  33758. var cosh2_x,
  33759. i = k,
  33760. d8 = new Ctor(8);
  33761. for (; i--;) {
  33762. cosh2_x = x.times(x);
  33763. x = one.minus(cosh2_x.times(d8.minus(cosh2_x.times(d8))));
  33764. }
  33765. return finalise(x, Ctor.precision = pr, Ctor.rounding = rm, true);
  33766. };
  33767. /*
  33768. * Return a new Decimal whose value is the hyperbolic sine of the value in radians of this
  33769. * Decimal.
  33770. *
  33771. * Domain: [-Infinity, Infinity]
  33772. * Range: [-Infinity, Infinity]
  33773. *
  33774. * sinh(x) = x + x^3/3! + x^5/5! + x^7/7! + ...
  33775. *
  33776. * sinh(0) = 0
  33777. * sinh(-0) = -0
  33778. * sinh(Infinity) = Infinity
  33779. * sinh(-Infinity) = -Infinity
  33780. * sinh(NaN) = NaN
  33781. *
  33782. * x time taken (ms)
  33783. * 10 2 ms
  33784. * 100 5 ms
  33785. * 1000 14 ms
  33786. * 10000 82 ms
  33787. * 100000 886 ms 1.4033316802130615897e+43429
  33788. * 200000 2613 ms
  33789. * 300000 5407 ms
  33790. * 400000 8824 ms
  33791. * 500000 13026 ms 8.7080643612718084129e+217146
  33792. * 1000000 48543 ms
  33793. *
  33794. * TODO? Compare performance of sinh(x) = 0.5 * (exp(x) - exp(-x))
  33795. *
  33796. */
  33797. P.hyperbolicSine = P.sinh = function () {
  33798. var k,
  33799. pr,
  33800. rm,
  33801. len,
  33802. x = this,
  33803. Ctor = x.constructor;
  33804. if (!x.isFinite() || x.isZero()) return new Ctor(x);
  33805. pr = Ctor.precision;
  33806. rm = Ctor.rounding;
  33807. Ctor.precision = pr + Math.max(x.e, x.sd()) + 4;
  33808. Ctor.rounding = 1;
  33809. len = x.d.length;
  33810. if (len < 3) {
  33811. x = taylorSeries(Ctor, 2, x, x, true);
  33812. } else {
  33813. // Alternative argument reduction: sinh(3x) = sinh(x)(3 + 4sinh^2(x))
  33814. // i.e. sinh(x) = sinh(x/3)(3 + 4sinh^2(x/3))
  33815. // 3 multiplications and 1 addition
  33816. // Argument reduction: sinh(5x) = sinh(x)(5 + sinh^2(x)(20 + 16sinh^2(x)))
  33817. // i.e. sinh(x) = sinh(x/5)(5 + sinh^2(x/5)(20 + 16sinh^2(x/5)))
  33818. // 4 multiplications and 2 additions
  33819. // Estimate the optimum number of times to use the argument reduction.
  33820. k = 1.4 * Math.sqrt(len);
  33821. k = k > 16 ? 16 : k | 0;
  33822. x = x.times(Math.pow(5, -k));
  33823. x = taylorSeries(Ctor, 2, x, x, true);
  33824. // Reverse argument reduction
  33825. var sinh2_x,
  33826. d5 = new Ctor(5),
  33827. d16 = new Ctor(16),
  33828. d20 = new Ctor(20);
  33829. for (; k--;) {
  33830. sinh2_x = x.times(x);
  33831. x = x.times(d5.plus(sinh2_x.times(d16.times(sinh2_x).plus(d20))));
  33832. }
  33833. }
  33834. Ctor.precision = pr;
  33835. Ctor.rounding = rm;
  33836. return finalise(x, pr, rm, true);
  33837. };
  33838. /*
  33839. * Return a new Decimal whose value is the hyperbolic tangent of the value in radians of this
  33840. * Decimal.
  33841. *
  33842. * Domain: [-Infinity, Infinity]
  33843. * Range: [-1, 1]
  33844. *
  33845. * tanh(x) = sinh(x) / cosh(x)
  33846. *
  33847. * tanh(0) = 0
  33848. * tanh(-0) = -0
  33849. * tanh(Infinity) = 1
  33850. * tanh(-Infinity) = -1
  33851. * tanh(NaN) = NaN
  33852. *
  33853. */
  33854. P.hyperbolicTangent = P.tanh = function () {
  33855. var pr,
  33856. rm,
  33857. x = this,
  33858. Ctor = x.constructor;
  33859. if (!x.isFinite()) return new Ctor(x.s);
  33860. if (x.isZero()) return new Ctor(x);
  33861. pr = Ctor.precision;
  33862. rm = Ctor.rounding;
  33863. Ctor.precision = pr + 7;
  33864. Ctor.rounding = 1;
  33865. return divide(x.sinh(), x.cosh(), Ctor.precision = pr, Ctor.rounding = rm);
  33866. };
  33867. /*
  33868. * Return a new Decimal whose value is the arccosine (inverse cosine) in radians of the value of
  33869. * this Decimal.
  33870. *
  33871. * Domain: [-1, 1]
  33872. * Range: [0, pi]
  33873. *
  33874. * acos(x) = pi/2 - asin(x)
  33875. *
  33876. * acos(0) = pi/2
  33877. * acos(-0) = pi/2
  33878. * acos(1) = 0
  33879. * acos(-1) = pi
  33880. * acos(1/2) = pi/3
  33881. * acos(-1/2) = 2*pi/3
  33882. * acos(|x| > 1) = NaN
  33883. * acos(NaN) = NaN
  33884. *
  33885. */
  33886. P.inverseCosine = P.acos = function () {
  33887. var halfPi,
  33888. x = this,
  33889. Ctor = x.constructor,
  33890. k = x.abs().cmp(1),
  33891. pr = Ctor.precision,
  33892. rm = Ctor.rounding;
  33893. if (k !== -1) {
  33894. return k === 0
  33895. // |x| is 1
  33896. ? x.isNeg() ? getPi(Ctor, pr, rm) : new Ctor(0)
  33897. // |x| > 1 or x is NaN
  33898. : new Ctor(NaN);
  33899. }
  33900. if (x.isZero()) return getPi(Ctor, pr + 4, rm).times(0.5);
  33901. // TODO? Special case acos(0.5) = pi/3 and acos(-0.5) = 2*pi/3
  33902. Ctor.precision = pr + 6;
  33903. Ctor.rounding = 1;
  33904. x = x.asin();
  33905. halfPi = getPi(Ctor, pr + 4, rm).times(0.5);
  33906. Ctor.precision = pr;
  33907. Ctor.rounding = rm;
  33908. return halfPi.minus(x);
  33909. };
  33910. /*
  33911. * Return a new Decimal whose value is the inverse of the hyperbolic cosine in radians of the
  33912. * value of this Decimal.
  33913. *
  33914. * Domain: [1, Infinity]
  33915. * Range: [0, Infinity]
  33916. *
  33917. * acosh(x) = ln(x + sqrt(x^2 - 1))
  33918. *
  33919. * acosh(x < 1) = NaN
  33920. * acosh(NaN) = NaN
  33921. * acosh(Infinity) = Infinity
  33922. * acosh(-Infinity) = NaN
  33923. * acosh(0) = NaN
  33924. * acosh(-0) = NaN
  33925. * acosh(1) = 0
  33926. * acosh(-1) = NaN
  33927. *
  33928. */
  33929. P.inverseHyperbolicCosine = P.acosh = function () {
  33930. var pr,
  33931. rm,
  33932. x = this,
  33933. Ctor = x.constructor;
  33934. if (x.lte(1)) return new Ctor(x.eq(1) ? 0 : NaN);
  33935. if (!x.isFinite()) return new Ctor(x);
  33936. pr = Ctor.precision;
  33937. rm = Ctor.rounding;
  33938. Ctor.precision = pr + Math.max(Math.abs(x.e), x.sd()) + 4;
  33939. Ctor.rounding = 1;
  33940. external = false;
  33941. x = x.times(x).minus(1).sqrt().plus(x);
  33942. external = true;
  33943. Ctor.precision = pr;
  33944. Ctor.rounding = rm;
  33945. return x.ln();
  33946. };
  33947. /*
  33948. * Return a new Decimal whose value is the inverse of the hyperbolic sine in radians of the value
  33949. * of this Decimal.
  33950. *
  33951. * Domain: [-Infinity, Infinity]
  33952. * Range: [-Infinity, Infinity]
  33953. *
  33954. * asinh(x) = ln(x + sqrt(x^2 + 1))
  33955. *
  33956. * asinh(NaN) = NaN
  33957. * asinh(Infinity) = Infinity
  33958. * asinh(-Infinity) = -Infinity
  33959. * asinh(0) = 0
  33960. * asinh(-0) = -0
  33961. *
  33962. */
  33963. P.inverseHyperbolicSine = P.asinh = function () {
  33964. var pr,
  33965. rm,
  33966. x = this,
  33967. Ctor = x.constructor;
  33968. if (!x.isFinite() || x.isZero()) return new Ctor(x);
  33969. pr = Ctor.precision;
  33970. rm = Ctor.rounding;
  33971. Ctor.precision = pr + 2 * Math.max(Math.abs(x.e), x.sd()) + 6;
  33972. Ctor.rounding = 1;
  33973. external = false;
  33974. x = x.times(x).plus(1).sqrt().plus(x);
  33975. external = true;
  33976. Ctor.precision = pr;
  33977. Ctor.rounding = rm;
  33978. return x.ln();
  33979. };
  33980. /*
  33981. * Return a new Decimal whose value is the inverse of the hyperbolic tangent in radians of the
  33982. * value of this Decimal.
  33983. *
  33984. * Domain: [-1, 1]
  33985. * Range: [-Infinity, Infinity]
  33986. *
  33987. * atanh(x) = 0.5 * ln((1 + x) / (1 - x))
  33988. *
  33989. * atanh(|x| > 1) = NaN
  33990. * atanh(NaN) = NaN
  33991. * atanh(Infinity) = NaN
  33992. * atanh(-Infinity) = NaN
  33993. * atanh(0) = 0
  33994. * atanh(-0) = -0
  33995. * atanh(1) = Infinity
  33996. * atanh(-1) = -Infinity
  33997. *
  33998. */
  33999. P.inverseHyperbolicTangent = P.atanh = function () {
  34000. var pr,
  34001. rm,
  34002. wpr,
  34003. xsd,
  34004. x = this,
  34005. Ctor = x.constructor;
  34006. if (!x.isFinite()) return new Ctor(NaN);
  34007. if (x.e >= 0) return new Ctor(x.abs().eq(1) ? x.s / 0 : x.isZero() ? x : NaN);
  34008. pr = Ctor.precision;
  34009. rm = Ctor.rounding;
  34010. xsd = x.sd();
  34011. if (Math.max(xsd, pr) < 2 * -x.e - 1) return finalise(new Ctor(x), pr, rm, true);
  34012. Ctor.precision = wpr = xsd - x.e;
  34013. x = divide(x.plus(1), new Ctor(1).minus(x), wpr + pr, 1);
  34014. Ctor.precision = pr + 4;
  34015. Ctor.rounding = 1;
  34016. x = x.ln();
  34017. Ctor.precision = pr;
  34018. Ctor.rounding = rm;
  34019. return x.times(0.5);
  34020. };
  34021. /*
  34022. * Return a new Decimal whose value is the arcsine (inverse sine) in radians of the value of this
  34023. * Decimal.
  34024. *
  34025. * Domain: [-Infinity, Infinity]
  34026. * Range: [-pi/2, pi/2]
  34027. *
  34028. * asin(x) = 2*atan(x/(1 + sqrt(1 - x^2)))
  34029. *
  34030. * asin(0) = 0
  34031. * asin(-0) = -0
  34032. * asin(1/2) = pi/6
  34033. * asin(-1/2) = -pi/6
  34034. * asin(1) = pi/2
  34035. * asin(-1) = -pi/2
  34036. * asin(|x| > 1) = NaN
  34037. * asin(NaN) = NaN
  34038. *
  34039. * TODO? Compare performance of Taylor series.
  34040. *
  34041. */
  34042. P.inverseSine = P.asin = function () {
  34043. var halfPi,
  34044. k,
  34045. pr,
  34046. rm,
  34047. x = this,
  34048. Ctor = x.constructor;
  34049. if (x.isZero()) return new Ctor(x);
  34050. k = x.abs().cmp(1);
  34051. pr = Ctor.precision;
  34052. rm = Ctor.rounding;
  34053. if (k !== -1) {
  34054. // |x| is 1
  34055. if (k === 0) {
  34056. halfPi = getPi(Ctor, pr + 4, rm).times(0.5);
  34057. halfPi.s = x.s;
  34058. return halfPi;
  34059. }
  34060. // |x| > 1 or x is NaN
  34061. return new Ctor(NaN);
  34062. }
  34063. // TODO? Special case asin(1/2) = pi/6 and asin(-1/2) = -pi/6
  34064. Ctor.precision = pr + 6;
  34065. Ctor.rounding = 1;
  34066. x = x.div(new Ctor(1).minus(x.times(x)).sqrt().plus(1)).atan();
  34067. Ctor.precision = pr;
  34068. Ctor.rounding = rm;
  34069. return x.times(2);
  34070. };
  34071. /*
  34072. * Return a new Decimal whose value is the arctangent (inverse tangent) in radians of the value
  34073. * of this Decimal.
  34074. *
  34075. * Domain: [-Infinity, Infinity]
  34076. * Range: [-pi/2, pi/2]
  34077. *
  34078. * atan(x) = x - x^3/3 + x^5/5 - x^7/7 + ...
  34079. *
  34080. * atan(0) = 0
  34081. * atan(-0) = -0
  34082. * atan(1) = pi/4
  34083. * atan(-1) = -pi/4
  34084. * atan(Infinity) = pi/2
  34085. * atan(-Infinity) = -pi/2
  34086. * atan(NaN) = NaN
  34087. *
  34088. */
  34089. P.inverseTangent = P.atan = function () {
  34090. var i,
  34091. j,
  34092. k,
  34093. n,
  34094. px,
  34095. t,
  34096. r,
  34097. wpr,
  34098. x2,
  34099. x = this,
  34100. Ctor = x.constructor,
  34101. pr = Ctor.precision,
  34102. rm = Ctor.rounding;
  34103. if (!x.isFinite()) {
  34104. if (!x.s) return new Ctor(NaN);
  34105. if (pr + 4 <= PI_PRECISION) {
  34106. r = getPi(Ctor, pr + 4, rm).times(0.5);
  34107. r.s = x.s;
  34108. return r;
  34109. }
  34110. } else if (x.isZero()) {
  34111. return new Ctor(x);
  34112. } else if (x.abs().eq(1) && pr + 4 <= PI_PRECISION) {
  34113. r = getPi(Ctor, pr + 4, rm).times(0.25);
  34114. r.s = x.s;
  34115. return r;
  34116. }
  34117. Ctor.precision = wpr = pr + 10;
  34118. Ctor.rounding = 1;
  34119. // TODO? if (x >= 1 && pr <= PI_PRECISION) atan(x) = halfPi * x.s - atan(1 / x);
  34120. // Argument reduction
  34121. // Ensure |x| < 0.42
  34122. // atan(x) = 2 * atan(x / (1 + sqrt(1 + x^2)))
  34123. k = Math.min(28, wpr / LOG_BASE + 2 | 0);
  34124. for (i = k; i; --i) {
  34125. x = x.div(x.times(x).plus(1).sqrt().plus(1));
  34126. }external = false;
  34127. j = Math.ceil(wpr / LOG_BASE);
  34128. n = 1;
  34129. x2 = x.times(x);
  34130. r = new Ctor(x);
  34131. px = x;
  34132. // atan(x) = x - x^3/3 + x^5/5 - x^7/7 + ...
  34133. for (; i !== -1;) {
  34134. px = px.times(x2);
  34135. t = r.minus(px.div(n += 2));
  34136. px = px.times(x2);
  34137. r = t.plus(px.div(n += 2));
  34138. if (r.d[j] !== void 0) for (i = j; r.d[i] === t.d[i] && i--;) {}
  34139. }
  34140. if (k) r = r.times(2 << k - 1);
  34141. external = true;
  34142. return finalise(r, Ctor.precision = pr, Ctor.rounding = rm, true);
  34143. };
  34144. /*
  34145. * Return true if the value of this Decimal is a finite number, otherwise return false.
  34146. *
  34147. */
  34148. P.isFinite = function () {
  34149. return !!this.d;
  34150. };
  34151. /*
  34152. * Return true if the value of this Decimal is an integer, otherwise return false.
  34153. *
  34154. */
  34155. P.isInteger = P.isInt = function () {
  34156. return !!this.d && mathfloor(this.e / LOG_BASE) > this.d.length - 2;
  34157. };
  34158. /*
  34159. * Return true if the value of this Decimal is NaN, otherwise return false.
  34160. *
  34161. */
  34162. P.isNaN = function () {
  34163. return !this.s;
  34164. };
  34165. /*
  34166. * Return true if the value of this Decimal is negative, otherwise return false.
  34167. *
  34168. */
  34169. P.isNegative = P.isNeg = function () {
  34170. return this.s < 0;
  34171. };
  34172. /*
  34173. * Return true if the value of this Decimal is positive, otherwise return false.
  34174. *
  34175. */
  34176. P.isPositive = P.isPos = function () {
  34177. return this.s > 0;
  34178. };
  34179. /*
  34180. * Return true if the value of this Decimal is 0 or -0, otherwise return false.
  34181. *
  34182. */
  34183. P.isZero = function () {
  34184. return !!this.d && this.d[0] === 0;
  34185. };
  34186. /*
  34187. * Return true if the value of this Decimal is less than `y`, otherwise return false.
  34188. *
  34189. */
  34190. P.lessThan = P.lt = function (y) {
  34191. return this.cmp(y) < 0;
  34192. };
  34193. /*
  34194. * Return true if the value of this Decimal is less than or equal to `y`, otherwise return false.
  34195. *
  34196. */
  34197. P.lessThanOrEqualTo = P.lte = function (y) {
  34198. return this.cmp(y) < 1;
  34199. };
  34200. /*
  34201. * Return the logarithm of the value of this Decimal to the specified base, rounded to `precision`
  34202. * significant digits using rounding mode `rounding`.
  34203. *
  34204. * If no base is specified, return log[10](arg).
  34205. *
  34206. * log[base](arg) = ln(arg) / ln(base)
  34207. *
  34208. * The result will always be correctly rounded if the base of the log is 10, and 'almost always'
  34209. * otherwise:
  34210. *
  34211. * Depending on the rounding mode, the result may be incorrectly rounded if the first fifteen
  34212. * rounding digits are [49]99999999999999 or [50]00000000000000. In that case, the maximum error
  34213. * between the result and the correctly rounded result will be one ulp (unit in the last place).
  34214. *
  34215. * log[-b](a) = NaN
  34216. * log[0](a) = NaN
  34217. * log[1](a) = NaN
  34218. * log[NaN](a) = NaN
  34219. * log[Infinity](a) = NaN
  34220. * log[b](0) = -Infinity
  34221. * log[b](-0) = -Infinity
  34222. * log[b](-a) = NaN
  34223. * log[b](1) = 0
  34224. * log[b](Infinity) = Infinity
  34225. * log[b](NaN) = NaN
  34226. *
  34227. * [base] {number|string|Decimal} The base of the logarithm.
  34228. *
  34229. */
  34230. P.logarithm = P.log = function (base) {
  34231. var isBase10,
  34232. d,
  34233. denominator,
  34234. k,
  34235. inf,
  34236. num,
  34237. sd,
  34238. r,
  34239. arg = this,
  34240. Ctor = arg.constructor,
  34241. pr = Ctor.precision,
  34242. rm = Ctor.rounding,
  34243. guard = 5;
  34244. // Default base is 10.
  34245. if (base == null) {
  34246. base = new Ctor(10);
  34247. isBase10 = true;
  34248. } else {
  34249. base = new Ctor(base);
  34250. d = base.d;
  34251. // Return NaN if base is negative, or non-finite, or is 0 or 1.
  34252. if (base.s < 0 || !d || !d[0] || base.eq(1)) return new Ctor(NaN);
  34253. isBase10 = base.eq(10);
  34254. }
  34255. d = arg.d;
  34256. // Is arg negative, non-finite, 0 or 1?
  34257. if (arg.s < 0 || !d || !d[0] || arg.eq(1)) {
  34258. return new Ctor(d && !d[0] ? -1 / 0 : arg.s != 1 ? NaN : d ? 0 : 1 / 0);
  34259. }
  34260. // The result will have a non-terminating decimal expansion if base is 10 and arg is not an
  34261. // integer power of 10.
  34262. if (isBase10) {
  34263. if (d.length > 1) {
  34264. inf = true;
  34265. } else {
  34266. for (k = d[0]; k % 10 === 0;) {
  34267. k /= 10;
  34268. }inf = k !== 1;
  34269. }
  34270. }
  34271. external = false;
  34272. sd = pr + guard;
  34273. num = naturalLogarithm(arg, sd);
  34274. denominator = isBase10 ? getLn10(Ctor, sd + 10) : naturalLogarithm(base, sd);
  34275. // The result will have 5 rounding digits.
  34276. r = divide(num, denominator, sd, 1);
  34277. // If at a rounding boundary, i.e. the result's rounding digits are [49]9999 or [50]0000,
  34278. // calculate 10 further digits.
  34279. //
  34280. // If the result is known to have an infinite decimal expansion, repeat this until it is clear
  34281. // that the result is above or below the boundary. Otherwise, if after calculating the 10
  34282. // further digits, the last 14 are nines, round up and assume the result is exact.
  34283. // Also assume the result is exact if the last 14 are zero.
  34284. //
  34285. // Example of a result that will be incorrectly rounded:
  34286. // log[1048576](4503599627370502) = 2.60000000000000009610279511444746...
  34287. // The above result correctly rounded using ROUND_CEIL to 1 decimal place should be 2.7, but it
  34288. // will be given as 2.6 as there are 15 zeros immediately after the requested decimal place, so
  34289. // the exact result would be assumed to be 2.6, which rounded using ROUND_CEIL to 1 decimal
  34290. // place is still 2.6.
  34291. if (checkRoundingDigits(r.d, k = pr, rm)) {
  34292. do {
  34293. sd += 10;
  34294. num = naturalLogarithm(arg, sd);
  34295. denominator = isBase10 ? getLn10(Ctor, sd + 10) : naturalLogarithm(base, sd);
  34296. r = divide(num, denominator, sd, 1);
  34297. if (!inf) {
  34298. // Check for 14 nines from the 2nd rounding digit, as the first may be 4.
  34299. if (+digitsToString(r.d).slice(k + 1, k + 15) + 1 == 1e14) {
  34300. r = finalise(r, pr + 1, 0);
  34301. }
  34302. break;
  34303. }
  34304. } while (checkRoundingDigits(r.d, k += 10, rm));
  34305. }
  34306. external = true;
  34307. return finalise(r, pr, rm);
  34308. };
  34309. /*
  34310. * Return a new Decimal whose value is the maximum of the arguments and the value of this Decimal.
  34311. *
  34312. * arguments {number|string|Decimal}
  34313. *
  34314. P.max = function () {
  34315. Array.prototype.push.call(arguments, this);
  34316. return maxOrMin(this.constructor, arguments, 'lt');
  34317. };
  34318. */
  34319. /*
  34320. * Return a new Decimal whose value is the minimum of the arguments and the value of this Decimal.
  34321. *
  34322. * arguments {number|string|Decimal}
  34323. *
  34324. P.min = function () {
  34325. Array.prototype.push.call(arguments, this);
  34326. return maxOrMin(this.constructor, arguments, 'gt');
  34327. };
  34328. */
  34329. /*
  34330. * n - 0 = n
  34331. * n - N = N
  34332. * n - I = -I
  34333. * 0 - n = -n
  34334. * 0 - 0 = 0
  34335. * 0 - N = N
  34336. * 0 - I = -I
  34337. * N - n = N
  34338. * N - 0 = N
  34339. * N - N = N
  34340. * N - I = N
  34341. * I - n = I
  34342. * I - 0 = I
  34343. * I - N = N
  34344. * I - I = N
  34345. *
  34346. * Return a new Decimal whose value is the value of this Decimal minus `y`, rounded to `precision`
  34347. * significant digits using rounding mode `rounding`.
  34348. *
  34349. */
  34350. P.minus = P.sub = function (y) {
  34351. var d,
  34352. e,
  34353. i,
  34354. j,
  34355. k,
  34356. len,
  34357. pr,
  34358. rm,
  34359. xd,
  34360. xe,
  34361. xLTy,
  34362. yd,
  34363. x = this,
  34364. Ctor = x.constructor;
  34365. y = new Ctor(y);
  34366. // If either is not finite...
  34367. if (!x.d || !y.d) {
  34368. // Return NaN if either is NaN.
  34369. if (!x.s || !y.s) y = new Ctor(NaN);
  34370. // Return y negated if x is finite and y is ±Infinity.
  34371. else if (x.d) y.s = -y.s;
  34372. // Return x if y is finite and x is ±Infinity.
  34373. // Return x if both are ±Infinity with different signs.
  34374. // Return NaN if both are ±Infinity with the same sign.
  34375. else y = new Ctor(y.d || x.s !== y.s ? x : NaN);
  34376. return y;
  34377. }
  34378. // If signs differ...
  34379. if (x.s != y.s) {
  34380. y.s = -y.s;
  34381. return x.plus(y);
  34382. }
  34383. xd = x.d;
  34384. yd = y.d;
  34385. pr = Ctor.precision;
  34386. rm = Ctor.rounding;
  34387. // If either is zero...
  34388. if (!xd[0] || !yd[0]) {
  34389. // Return y negated if x is zero and y is non-zero.
  34390. if (yd[0]) y.s = -y.s;
  34391. // Return x if y is zero and x is non-zero.
  34392. else if (xd[0]) y = new Ctor(x);
  34393. // Return zero if both are zero.
  34394. // From IEEE 754 (2008) 6.3: 0 - 0 = -0 - -0 = -0 when rounding to -Infinity.
  34395. else return new Ctor(rm === 3 ? -0 : 0);
  34396. return external ? finalise(y, pr, rm) : y;
  34397. }
  34398. // x and y are finite, non-zero numbers with the same sign.
  34399. // Calculate base 1e7 exponents.
  34400. e = mathfloor(y.e / LOG_BASE);
  34401. xe = mathfloor(x.e / LOG_BASE);
  34402. xd = xd.slice();
  34403. k = xe - e;
  34404. // If base 1e7 exponents differ...
  34405. if (k) {
  34406. xLTy = k < 0;
  34407. if (xLTy) {
  34408. d = xd;
  34409. k = -k;
  34410. len = yd.length;
  34411. } else {
  34412. d = yd;
  34413. e = xe;
  34414. len = xd.length;
  34415. }
  34416. // Numbers with massively different exponents would result in a very high number of
  34417. // zeros needing to be prepended, but this can be avoided while still ensuring correct
  34418. // rounding by limiting the number of zeros to `Math.ceil(pr / LOG_BASE) + 2`.
  34419. i = Math.max(Math.ceil(pr / LOG_BASE), len) + 2;
  34420. if (k > i) {
  34421. k = i;
  34422. d.length = 1;
  34423. }
  34424. // Prepend zeros to equalise exponents.
  34425. d.reverse();
  34426. for (i = k; i--;) {
  34427. d.push(0);
  34428. }d.reverse();
  34429. // Base 1e7 exponents equal.
  34430. } else {
  34431. // Check digits to determine which is the bigger number.
  34432. i = xd.length;
  34433. len = yd.length;
  34434. xLTy = i < len;
  34435. if (xLTy) len = i;
  34436. for (i = 0; i < len; i++) {
  34437. if (xd[i] != yd[i]) {
  34438. xLTy = xd[i] < yd[i];
  34439. break;
  34440. }
  34441. }
  34442. k = 0;
  34443. }
  34444. if (xLTy) {
  34445. d = xd;
  34446. xd = yd;
  34447. yd = d;
  34448. y.s = -y.s;
  34449. }
  34450. len = xd.length;
  34451. // Append zeros to `xd` if shorter.
  34452. // Don't add zeros to `yd` if shorter as subtraction only needs to start at `yd` length.
  34453. for (i = yd.length - len; i > 0; --i) {
  34454. xd[len++] = 0;
  34455. } // Subtract yd from xd.
  34456. for (i = yd.length; i > k;) {
  34457. if (xd[--i] < yd[i]) {
  34458. for (j = i; j && xd[--j] === 0;) {
  34459. xd[j] = BASE - 1;
  34460. }--xd[j];
  34461. xd[i] += BASE;
  34462. }
  34463. xd[i] -= yd[i];
  34464. }
  34465. // Remove trailing zeros.
  34466. for (; xd[--len] === 0;) {
  34467. xd.pop();
  34468. } // Remove leading zeros and adjust exponent accordingly.
  34469. for (; xd[0] === 0; xd.shift()) {
  34470. --e;
  34471. } // Zero?
  34472. if (!xd[0]) return new Ctor(rm === 3 ? -0 : 0);
  34473. y.d = xd;
  34474. y.e = getBase10Exponent(xd, e);
  34475. return external ? finalise(y, pr, rm) : y;
  34476. };
  34477. /*
  34478. * n % 0 = N
  34479. * n % N = N
  34480. * n % I = n
  34481. * 0 % n = 0
  34482. * -0 % n = -0
  34483. * 0 % 0 = N
  34484. * 0 % N = N
  34485. * 0 % I = 0
  34486. * N % n = N
  34487. * N % 0 = N
  34488. * N % N = N
  34489. * N % I = N
  34490. * I % n = N
  34491. * I % 0 = N
  34492. * I % N = N
  34493. * I % I = N
  34494. *
  34495. * Return a new Decimal whose value is the value of this Decimal modulo `y`, rounded to
  34496. * `precision` significant digits using rounding mode `rounding`.
  34497. *
  34498. * The result depends on the modulo mode.
  34499. *
  34500. */
  34501. P.modulo = P.mod = function (y) {
  34502. var q,
  34503. x = this,
  34504. Ctor = x.constructor;
  34505. y = new Ctor(y);
  34506. // Return NaN if x is ±Infinity or NaN, or y is NaN or ±0.
  34507. if (!x.d || !y.s || y.d && !y.d[0]) return new Ctor(NaN);
  34508. // Return x if y is ±Infinity or x is ±0.
  34509. if (!y.d || x.d && !x.d[0]) {
  34510. return finalise(new Ctor(x), Ctor.precision, Ctor.rounding);
  34511. }
  34512. // Prevent rounding of intermediate calculations.
  34513. external = false;
  34514. if (Ctor.modulo == 9) {
  34515. // Euclidian division: q = sign(y) * floor(x / abs(y))
  34516. // result = x - q * y where 0 <= result < abs(y)
  34517. q = divide(x, y.abs(), 0, 3, 1);
  34518. q.s *= y.s;
  34519. } else {
  34520. q = divide(x, y, 0, Ctor.modulo, 1);
  34521. }
  34522. q = q.times(y);
  34523. external = true;
  34524. return x.minus(q);
  34525. };
  34526. /*
  34527. * Return a new Decimal whose value is the natural exponential of the value of this Decimal,
  34528. * i.e. the base e raised to the power the value of this Decimal, rounded to `precision`
  34529. * significant digits using rounding mode `rounding`.
  34530. *
  34531. */
  34532. P.naturalExponential = P.exp = function () {
  34533. return naturalExponential(this);
  34534. };
  34535. /*
  34536. * Return a new Decimal whose value is the natural logarithm of the value of this Decimal,
  34537. * rounded to `precision` significant digits using rounding mode `rounding`.
  34538. *
  34539. */
  34540. P.naturalLogarithm = P.ln = function () {
  34541. return naturalLogarithm(this);
  34542. };
  34543. /*
  34544. * Return a new Decimal whose value is the value of this Decimal negated, i.e. as if multiplied by
  34545. * -1.
  34546. *
  34547. */
  34548. P.negated = P.neg = function () {
  34549. var x = new this.constructor(this);
  34550. x.s = -x.s;
  34551. return finalise(x);
  34552. };
  34553. /*
  34554. * n + 0 = n
  34555. * n + N = N
  34556. * n + I = I
  34557. * 0 + n = n
  34558. * 0 + 0 = 0
  34559. * 0 + N = N
  34560. * 0 + I = I
  34561. * N + n = N
  34562. * N + 0 = N
  34563. * N + N = N
  34564. * N + I = N
  34565. * I + n = I
  34566. * I + 0 = I
  34567. * I + N = N
  34568. * I + I = I
  34569. *
  34570. * Return a new Decimal whose value is the value of this Decimal plus `y`, rounded to `precision`
  34571. * significant digits using rounding mode `rounding`.
  34572. *
  34573. */
  34574. P.plus = P.add = function (y) {
  34575. var carry,
  34576. d,
  34577. e,
  34578. i,
  34579. k,
  34580. len,
  34581. pr,
  34582. rm,
  34583. xd,
  34584. yd,
  34585. x = this,
  34586. Ctor = x.constructor;
  34587. y = new Ctor(y);
  34588. // If either is not finite...
  34589. if (!x.d || !y.d) {
  34590. // Return NaN if either is NaN.
  34591. if (!x.s || !y.s) y = new Ctor(NaN);
  34592. // Return x if y is finite and x is ±Infinity.
  34593. // Return x if both are ±Infinity with the same sign.
  34594. // Return NaN if both are ±Infinity with different signs.
  34595. // Return y if x is finite and y is ±Infinity.
  34596. else if (!x.d) y = new Ctor(y.d || x.s === y.s ? x : NaN);
  34597. return y;
  34598. }
  34599. // If signs differ...
  34600. if (x.s != y.s) {
  34601. y.s = -y.s;
  34602. return x.minus(y);
  34603. }
  34604. xd = x.d;
  34605. yd = y.d;
  34606. pr = Ctor.precision;
  34607. rm = Ctor.rounding;
  34608. // If either is zero...
  34609. if (!xd[0] || !yd[0]) {
  34610. // Return x if y is zero.
  34611. // Return y if y is non-zero.
  34612. if (!yd[0]) y = new Ctor(x);
  34613. return external ? finalise(y, pr, rm) : y;
  34614. }
  34615. // x and y are finite, non-zero numbers with the same sign.
  34616. // Calculate base 1e7 exponents.
  34617. k = mathfloor(x.e / LOG_BASE);
  34618. e = mathfloor(y.e / LOG_BASE);
  34619. xd = xd.slice();
  34620. i = k - e;
  34621. // If base 1e7 exponents differ...
  34622. if (i) {
  34623. if (i < 0) {
  34624. d = xd;
  34625. i = -i;
  34626. len = yd.length;
  34627. } else {
  34628. d = yd;
  34629. e = k;
  34630. len = xd.length;
  34631. }
  34632. // Limit number of zeros prepended to max(ceil(pr / LOG_BASE), len) + 1.
  34633. k = Math.ceil(pr / LOG_BASE);
  34634. len = k > len ? k + 1 : len + 1;
  34635. if (i > len) {
  34636. i = len;
  34637. d.length = 1;
  34638. }
  34639. // Prepend zeros to equalise exponents. Note: Faster to use reverse then do unshifts.
  34640. d.reverse();
  34641. for (; i--;) {
  34642. d.push(0);
  34643. }d.reverse();
  34644. }
  34645. len = xd.length;
  34646. i = yd.length;
  34647. // If yd is longer than xd, swap xd and yd so xd points to the longer array.
  34648. if (len - i < 0) {
  34649. i = len;
  34650. d = yd;
  34651. yd = xd;
  34652. xd = d;
  34653. }
  34654. // Only start adding at yd.length - 1 as the further digits of xd can be left as they are.
  34655. for (carry = 0; i;) {
  34656. carry = (xd[--i] = xd[i] + yd[i] + carry) / BASE | 0;
  34657. xd[i] %= BASE;
  34658. }
  34659. if (carry) {
  34660. xd.unshift(carry);
  34661. ++e;
  34662. }
  34663. // Remove trailing zeros.
  34664. // No need to check for zero, as +x + +y != 0 && -x + -y != 0
  34665. for (len = xd.length; xd[--len] == 0;) {
  34666. xd.pop();
  34667. }y.d = xd;
  34668. y.e = getBase10Exponent(xd, e);
  34669. return external ? finalise(y, pr, rm) : y;
  34670. };
  34671. /*
  34672. * Return the number of significant digits of the value of this Decimal.
  34673. *
  34674. * [z] {boolean|number} Whether to count integer-part trailing zeros: true, false, 1 or 0.
  34675. *
  34676. */
  34677. P.precision = P.sd = function (z) {
  34678. var k,
  34679. x = this;
  34680. if (z !== void 0 && z !== !!z && z !== 1 && z !== 0) throw Error(invalidArgument + z);
  34681. if (x.d) {
  34682. k = getPrecision(x.d);
  34683. if (z && x.e + 1 > k) k = x.e + 1;
  34684. } else {
  34685. k = NaN;
  34686. }
  34687. return k;
  34688. };
  34689. /*
  34690. * Return a new Decimal whose value is the value of this Decimal rounded to a whole number using
  34691. * rounding mode `rounding`.
  34692. *
  34693. */
  34694. P.round = function () {
  34695. var x = this,
  34696. Ctor = x.constructor;
  34697. return finalise(new Ctor(x), x.e + 1, Ctor.rounding);
  34698. };
  34699. /*
  34700. * Return a new Decimal whose value is the sine of the value in radians of this Decimal.
  34701. *
  34702. * Domain: [-Infinity, Infinity]
  34703. * Range: [-1, 1]
  34704. *
  34705. * sin(x) = x - x^3/3! + x^5/5! - ...
  34706. *
  34707. * sin(0) = 0
  34708. * sin(-0) = -0
  34709. * sin(Infinity) = NaN
  34710. * sin(-Infinity) = NaN
  34711. * sin(NaN) = NaN
  34712. *
  34713. */
  34714. P.sine = P.sin = function () {
  34715. var pr,
  34716. rm,
  34717. x = this,
  34718. Ctor = x.constructor;
  34719. if (!x.isFinite()) return new Ctor(NaN);
  34720. if (x.isZero()) return new Ctor(x);
  34721. pr = Ctor.precision;
  34722. rm = Ctor.rounding;
  34723. Ctor.precision = pr + Math.max(x.e, x.sd()) + LOG_BASE;
  34724. Ctor.rounding = 1;
  34725. x = sine(Ctor, toLessThanHalfPi(Ctor, x));
  34726. Ctor.precision = pr;
  34727. Ctor.rounding = rm;
  34728. return finalise(quadrant > 2 ? x.neg() : x, pr, rm, true);
  34729. };
  34730. /*
  34731. * Return a new Decimal whose value is the square root of this Decimal, rounded to `precision`
  34732. * significant digits using rounding mode `rounding`.
  34733. *
  34734. * sqrt(-n) = N
  34735. * sqrt(N) = N
  34736. * sqrt(-I) = N
  34737. * sqrt(I) = I
  34738. * sqrt(0) = 0
  34739. * sqrt(-0) = -0
  34740. *
  34741. */
  34742. P.squareRoot = P.sqrt = function () {
  34743. var m,
  34744. n,
  34745. sd,
  34746. r,
  34747. rep,
  34748. t,
  34749. x = this,
  34750. d = x.d,
  34751. e = x.e,
  34752. s = x.s,
  34753. Ctor = x.constructor;
  34754. // Negative/NaN/Infinity/zero?
  34755. if (s !== 1 || !d || !d[0]) {
  34756. return new Ctor(!s || s < 0 && (!d || d[0]) ? NaN : d ? x : 1 / 0);
  34757. }
  34758. external = false;
  34759. // Initial estimate.
  34760. s = Math.sqrt(+x);
  34761. // Math.sqrt underflow/overflow?
  34762. // Pass x to Math.sqrt as integer, then adjust the exponent of the result.
  34763. if (s == 0 || s == 1 / 0) {
  34764. n = digitsToString(d);
  34765. if ((n.length + e) % 2 == 0) n += '0';
  34766. s = Math.sqrt(n);
  34767. e = mathfloor((e + 1) / 2) - (e < 0 || e % 2);
  34768. if (s == 1 / 0) {
  34769. n = '1e' + e;
  34770. } else {
  34771. n = s.toExponential();
  34772. n = n.slice(0, n.indexOf('e') + 1) + e;
  34773. }
  34774. r = new Ctor(n);
  34775. } else {
  34776. r = new Ctor(s.toString());
  34777. }
  34778. sd = (e = Ctor.precision) + 3;
  34779. // Newton-Raphson iteration.
  34780. for (;;) {
  34781. t = r;
  34782. r = t.plus(divide(x, t, sd + 2, 1)).times(0.5);
  34783. // TODO? Replace with for-loop and checkRoundingDigits.
  34784. if (digitsToString(t.d).slice(0, sd) === (n = digitsToString(r.d)).slice(0, sd)) {
  34785. n = n.slice(sd - 3, sd + 1);
  34786. // The 4th rounding digit may be in error by -1 so if the 4 rounding digits are 9999 or
  34787. // 4999, i.e. approaching a rounding boundary, continue the iteration.
  34788. if (n == '9999' || !rep && n == '4999') {
  34789. // On the first iteration only, check to see if rounding up gives the exact result as the
  34790. // nines may infinitely repeat.
  34791. if (!rep) {
  34792. finalise(t, e + 1, 0);
  34793. if (t.times(t).eq(x)) {
  34794. r = t;
  34795. break;
  34796. }
  34797. }
  34798. sd += 4;
  34799. rep = 1;
  34800. } else {
  34801. // If the rounding digits are null, 0{0,4} or 50{0,3}, check for an exact result.
  34802. // If not, then there are further digits and m will be truthy.
  34803. if (!+n || !+n.slice(1) && n.charAt(0) == '5') {
  34804. // Truncate to the first rounding digit.
  34805. finalise(r, e + 1, 1);
  34806. m = !r.times(r).eq(x);
  34807. }
  34808. break;
  34809. }
  34810. }
  34811. }
  34812. external = true;
  34813. return finalise(r, e, Ctor.rounding, m);
  34814. };
  34815. /*
  34816. * Return a new Decimal whose value is the tangent of the value in radians of this Decimal.
  34817. *
  34818. * Domain: [-Infinity, Infinity]
  34819. * Range: [-Infinity, Infinity]
  34820. *
  34821. * tan(0) = 0
  34822. * tan(-0) = -0
  34823. * tan(Infinity) = NaN
  34824. * tan(-Infinity) = NaN
  34825. * tan(NaN) = NaN
  34826. *
  34827. */
  34828. P.tangent = P.tan = function () {
  34829. var pr,
  34830. rm,
  34831. x = this,
  34832. Ctor = x.constructor;
  34833. if (!x.isFinite()) return new Ctor(NaN);
  34834. if (x.isZero()) return new Ctor(x);
  34835. pr = Ctor.precision;
  34836. rm = Ctor.rounding;
  34837. Ctor.precision = pr + 10;
  34838. Ctor.rounding = 1;
  34839. x = x.sin();
  34840. x.s = 1;
  34841. x = divide(x, new Ctor(1).minus(x.times(x)).sqrt(), pr + 10, 0);
  34842. Ctor.precision = pr;
  34843. Ctor.rounding = rm;
  34844. return finalise(quadrant == 2 || quadrant == 4 ? x.neg() : x, pr, rm, true);
  34845. };
  34846. /*
  34847. * n * 0 = 0
  34848. * n * N = N
  34849. * n * I = I
  34850. * 0 * n = 0
  34851. * 0 * 0 = 0
  34852. * 0 * N = N
  34853. * 0 * I = N
  34854. * N * n = N
  34855. * N * 0 = N
  34856. * N * N = N
  34857. * N * I = N
  34858. * I * n = I
  34859. * I * 0 = N
  34860. * I * N = N
  34861. * I * I = I
  34862. *
  34863. * Return a new Decimal whose value is this Decimal times `y`, rounded to `precision` significant
  34864. * digits using rounding mode `rounding`.
  34865. *
  34866. */
  34867. P.times = P.mul = function (y) {
  34868. var carry,
  34869. e,
  34870. i,
  34871. k,
  34872. r,
  34873. rL,
  34874. t,
  34875. xdL,
  34876. ydL,
  34877. x = this,
  34878. Ctor = x.constructor,
  34879. xd = x.d,
  34880. yd = (y = new Ctor(y)).d;
  34881. y.s *= x.s;
  34882. // If either is NaN, ±Infinity or ±0...
  34883. if (!xd || !xd[0] || !yd || !yd[0]) {
  34884. return new Ctor(!y.s || xd && !xd[0] && !yd || yd && !yd[0] && !xd
  34885. // Return NaN if either is NaN.
  34886. // Return NaN if x is ±0 and y is ±Infinity, or y is ±0 and x is ±Infinity.
  34887. ? NaN
  34888. // Return ±Infinity if either is ±Infinity.
  34889. // Return ±0 if either is ±0.
  34890. : !xd || !yd ? y.s / 0 : y.s * 0);
  34891. }
  34892. e = mathfloor(x.e / LOG_BASE) + mathfloor(y.e / LOG_BASE);
  34893. xdL = xd.length;
  34894. ydL = yd.length;
  34895. // Ensure xd points to the longer array.
  34896. if (xdL < ydL) {
  34897. r = xd;
  34898. xd = yd;
  34899. yd = r;
  34900. rL = xdL;
  34901. xdL = ydL;
  34902. ydL = rL;
  34903. }
  34904. // Initialise the result array with zeros.
  34905. r = [];
  34906. rL = xdL + ydL;
  34907. for (i = rL; i--;) {
  34908. r.push(0);
  34909. } // Multiply!
  34910. for (i = ydL; --i >= 0;) {
  34911. carry = 0;
  34912. for (k = xdL + i; k > i;) {
  34913. t = r[k] + yd[i] * xd[k - i - 1] + carry;
  34914. r[k--] = t % BASE | 0;
  34915. carry = t / BASE | 0;
  34916. }
  34917. r[k] = (r[k] + carry) % BASE | 0;
  34918. }
  34919. // Remove trailing zeros.
  34920. for (; !r[--rL];) {
  34921. r.pop();
  34922. }if (carry) ++e;else r.shift();
  34923. y.d = r;
  34924. y.e = getBase10Exponent(r, e);
  34925. return external ? finalise(y, Ctor.precision, Ctor.rounding) : y;
  34926. };
  34927. /*
  34928. * Return a string representing the value of this Decimal in base 2, round to `sd` significant
  34929. * digits using rounding mode `rm`.
  34930. *
  34931. * If the optional `sd` argument is present then return binary exponential notation.
  34932. *
  34933. * [sd] {number} Significant digits. Integer, 1 to MAX_DIGITS inclusive.
  34934. * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.
  34935. *
  34936. */
  34937. P.toBinary = function (sd, rm) {
  34938. return toStringBinary(this, 2, sd, rm);
  34939. };
  34940. /*
  34941. * Return a new Decimal whose value is the value of this Decimal rounded to a maximum of `dp`
  34942. * decimal places using rounding mode `rm` or `rounding` if `rm` is omitted.
  34943. *
  34944. * If `dp` is omitted, return a new Decimal whose value is the value of this Decimal.
  34945. *
  34946. * [dp] {number} Decimal places. Integer, 0 to MAX_DIGITS inclusive.
  34947. * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.
  34948. *
  34949. */
  34950. P.toDecimalPlaces = P.toDP = function (dp, rm) {
  34951. var x = this,
  34952. Ctor = x.constructor;
  34953. x = new Ctor(x);
  34954. if (dp === void 0) return x;
  34955. checkInt32(dp, 0, MAX_DIGITS);
  34956. if (rm === void 0) rm = Ctor.rounding;else checkInt32(rm, 0, 8);
  34957. return finalise(x, dp + x.e + 1, rm);
  34958. };
  34959. /*
  34960. * Return a string representing the value of this Decimal in exponential notation rounded to
  34961. * `dp` fixed decimal places using rounding mode `rounding`.
  34962. *
  34963. * [dp] {number} Decimal places. Integer, 0 to MAX_DIGITS inclusive.
  34964. * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.
  34965. *
  34966. */
  34967. P.toExponential = function (dp, rm) {
  34968. var str,
  34969. x = this,
  34970. Ctor = x.constructor;
  34971. if (dp === void 0) {
  34972. str = finiteToString(x, true);
  34973. } else {
  34974. checkInt32(dp, 0, MAX_DIGITS);
  34975. if (rm === void 0) rm = Ctor.rounding;else checkInt32(rm, 0, 8);
  34976. x = finalise(new Ctor(x), dp + 1, rm);
  34977. str = finiteToString(x, true, dp + 1);
  34978. }
  34979. return x.isNeg() && !x.isZero() ? '-' + str : str;
  34980. };
  34981. /*
  34982. * Return a string representing the value of this Decimal in normal (fixed-point) notation to
  34983. * `dp` fixed decimal places and rounded using rounding mode `rm` or `rounding` if `rm` is
  34984. * omitted.
  34985. *
  34986. * As with JavaScript numbers, (-0).toFixed(0) is '0', but e.g. (-0.00001).toFixed(0) is '-0'.
  34987. *
  34988. * [dp] {number} Decimal places. Integer, 0 to MAX_DIGITS inclusive.
  34989. * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.
  34990. *
  34991. * (-0).toFixed(0) is '0', but (-0.1).toFixed(0) is '-0'.
  34992. * (-0).toFixed(1) is '0.0', but (-0.01).toFixed(1) is '-0.0'.
  34993. * (-0).toFixed(3) is '0.000'.
  34994. * (-0.5).toFixed(0) is '-0'.
  34995. *
  34996. */
  34997. P.toFixed = function (dp, rm) {
  34998. var str,
  34999. y,
  35000. x = this,
  35001. Ctor = x.constructor;
  35002. if (dp === void 0) {
  35003. str = finiteToString(x);
  35004. } else {
  35005. checkInt32(dp, 0, MAX_DIGITS);
  35006. if (rm === void 0) rm = Ctor.rounding;else checkInt32(rm, 0, 8);
  35007. y = finalise(new Ctor(x), dp + x.e + 1, rm);
  35008. str = finiteToString(y, false, dp + y.e + 1);
  35009. }
  35010. // To determine whether to add the minus sign look at the value before it was rounded,
  35011. // i.e. look at `x` rather than `y`.
  35012. return x.isNeg() && !x.isZero() ? '-' + str : str;
  35013. };
  35014. /*
  35015. * Return an array representing the value of this Decimal as a simple fraction with an integer
  35016. * numerator and an integer denominator.
  35017. *
  35018. * The denominator will be a positive non-zero value less than or equal to the specified maximum
  35019. * denominator. If a maximum denominator is not specified, the denominator will be the lowest
  35020. * value necessary to represent the number exactly.
  35021. *
  35022. * [maxD] {number|string|Decimal} Maximum denominator. Integer >= 1 and < Infinity.
  35023. *
  35024. */
  35025. P.toFraction = function (maxD) {
  35026. var d,
  35027. d0,
  35028. d1,
  35029. d2,
  35030. e,
  35031. k,
  35032. n,
  35033. n0,
  35034. n1,
  35035. pr,
  35036. q,
  35037. r,
  35038. x = this,
  35039. xd = x.d,
  35040. Ctor = x.constructor;
  35041. if (!xd) return new Ctor(x);
  35042. n1 = d0 = new Ctor(1);
  35043. d1 = n0 = new Ctor(0);
  35044. d = new Ctor(d1);
  35045. e = d.e = getPrecision(xd) - x.e - 1;
  35046. k = e % LOG_BASE;
  35047. d.d[0] = mathpow(10, k < 0 ? LOG_BASE + k : k);
  35048. if (maxD == null) {
  35049. // d is 10**e, the minimum max-denominator needed.
  35050. maxD = e > 0 ? d : n1;
  35051. } else {
  35052. n = new Ctor(maxD);
  35053. if (!n.isInt() || n.lt(n1)) throw Error(invalidArgument + n);
  35054. maxD = n.gt(d) ? e > 0 ? d : n1 : n;
  35055. }
  35056. external = false;
  35057. n = new Ctor(digitsToString(xd));
  35058. pr = Ctor.precision;
  35059. Ctor.precision = e = xd.length * LOG_BASE * 2;
  35060. for (;;) {
  35061. q = divide(n, d, 0, 1, 1);
  35062. d2 = d0.plus(q.times(d1));
  35063. if (d2.cmp(maxD) == 1) break;
  35064. d0 = d1;
  35065. d1 = d2;
  35066. d2 = n1;
  35067. n1 = n0.plus(q.times(d2));
  35068. n0 = d2;
  35069. d2 = d;
  35070. d = n.minus(q.times(d2));
  35071. n = d2;
  35072. }
  35073. d2 = divide(maxD.minus(d0), d1, 0, 1, 1);
  35074. n0 = n0.plus(d2.times(n1));
  35075. d0 = d0.plus(d2.times(d1));
  35076. n0.s = n1.s = x.s;
  35077. // Determine which fraction is closer to x, n0/d0 or n1/d1?
  35078. r = divide(n1, d1, e, 1).minus(x).abs().cmp(divide(n0, d0, e, 1).minus(x).abs()) < 1 ? [n1, d1] : [n0, d0];
  35079. Ctor.precision = pr;
  35080. external = true;
  35081. return r;
  35082. };
  35083. /*
  35084. * Return a string representing the value of this Decimal in base 16, round to `sd` significant
  35085. * digits using rounding mode `rm`.
  35086. *
  35087. * If the optional `sd` argument is present then return binary exponential notation.
  35088. *
  35089. * [sd] {number} Significant digits. Integer, 1 to MAX_DIGITS inclusive.
  35090. * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.
  35091. *
  35092. */
  35093. P.toHexadecimal = P.toHex = function (sd, rm) {
  35094. return toStringBinary(this, 16, sd, rm);
  35095. };
  35096. /*
  35097. * Returns a new Decimal whose value is the nearest multiple of `y` in the direction of rounding
  35098. * mode `rm`, or `Decimal.rounding` if `rm` is omitted, to the value of this Decimal.
  35099. *
  35100. * The return value will always have the same sign as this Decimal, unless either this Decimal
  35101. * or `y` is NaN, in which case the return value will be also be NaN.
  35102. *
  35103. * The return value is not affected by the value of `precision`.
  35104. *
  35105. * y {number|string|Decimal} The magnitude to round to a multiple of.
  35106. * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.
  35107. *
  35108. * 'toNearest() rounding mode not an integer: {rm}'
  35109. * 'toNearest() rounding mode out of range: {rm}'
  35110. *
  35111. */
  35112. P.toNearest = function (y, rm) {
  35113. var x = this,
  35114. Ctor = x.constructor;
  35115. x = new Ctor(x);
  35116. if (y == null) {
  35117. // If x is not finite, return x.
  35118. if (!x.d) return x;
  35119. y = new Ctor(1);
  35120. rm = Ctor.rounding;
  35121. } else {
  35122. y = new Ctor(y);
  35123. if (rm === void 0) {
  35124. rm = Ctor.rounding;
  35125. } else {
  35126. checkInt32(rm, 0, 8);
  35127. }
  35128. // If x is not finite, return x if y is not NaN, else NaN.
  35129. if (!x.d) return y.s ? x : y;
  35130. // If y is not finite, return Infinity with the sign of x if y is Infinity, else NaN.
  35131. if (!y.d) {
  35132. if (y.s) y.s = x.s;
  35133. return y;
  35134. }
  35135. }
  35136. // If y is not zero, calculate the nearest multiple of y to x.
  35137. if (y.d[0]) {
  35138. external = false;
  35139. x = divide(x, y, 0, rm, 1).times(y);
  35140. external = true;
  35141. finalise(x);
  35142. // If y is zero, return zero with the sign of x.
  35143. } else {
  35144. y.s = x.s;
  35145. x = y;
  35146. }
  35147. return x;
  35148. };
  35149. /*
  35150. * Return the value of this Decimal converted to a number primitive.
  35151. * Zero keeps its sign.
  35152. *
  35153. */
  35154. P.toNumber = function () {
  35155. return +this;
  35156. };
  35157. /*
  35158. * Return a string representing the value of this Decimal in base 8, round to `sd` significant
  35159. * digits using rounding mode `rm`.
  35160. *
  35161. * If the optional `sd` argument is present then return binary exponential notation.
  35162. *
  35163. * [sd] {number} Significant digits. Integer, 1 to MAX_DIGITS inclusive.
  35164. * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.
  35165. *
  35166. */
  35167. P.toOctal = function (sd, rm) {
  35168. return toStringBinary(this, 8, sd, rm);
  35169. };
  35170. /*
  35171. * Return a new Decimal whose value is the value of this Decimal raised to the power `y`, rounded
  35172. * to `precision` significant digits using rounding mode `rounding`.
  35173. *
  35174. * ECMAScript compliant.
  35175. *
  35176. * pow(x, NaN) = NaN
  35177. * pow(x, ±0) = 1
  35178. * pow(NaN, non-zero) = NaN
  35179. * pow(abs(x) > 1, +Infinity) = +Infinity
  35180. * pow(abs(x) > 1, -Infinity) = +0
  35181. * pow(abs(x) == 1, ±Infinity) = NaN
  35182. * pow(abs(x) < 1, +Infinity) = +0
  35183. * pow(abs(x) < 1, -Infinity) = +Infinity
  35184. * pow(+Infinity, y > 0) = +Infinity
  35185. * pow(+Infinity, y < 0) = +0
  35186. * pow(-Infinity, odd integer > 0) = -Infinity
  35187. * pow(-Infinity, even integer > 0) = +Infinity
  35188. * pow(-Infinity, odd integer < 0) = -0
  35189. * pow(-Infinity, even integer < 0) = +0
  35190. * pow(+0, y > 0) = +0
  35191. * pow(+0, y < 0) = +Infinity
  35192. * pow(-0, odd integer > 0) = -0
  35193. * pow(-0, even integer > 0) = +0
  35194. * pow(-0, odd integer < 0) = -Infinity
  35195. * pow(-0, even integer < 0) = +Infinity
  35196. * pow(finite x < 0, finite non-integer) = NaN
  35197. *
  35198. * For non-integer or very large exponents pow(x, y) is calculated using
  35199. *
  35200. * x^y = exp(y*ln(x))
  35201. *
  35202. * Assuming the first 15 rounding digits are each equally likely to be any digit 0-9, the
  35203. * probability of an incorrectly rounded result
  35204. * P([49]9{14} | [50]0{14}) = 2 * 0.2 * 10^-14 = 4e-15 = 1/2.5e+14
  35205. * i.e. 1 in 250,000,000,000,000
  35206. *
  35207. * If a result is incorrectly rounded the maximum error will be 1 ulp (unit in last place).
  35208. *
  35209. * y {number|string|Decimal} The power to which to raise this Decimal.
  35210. *
  35211. */
  35212. P.toPower = P.pow = function (y) {
  35213. var e,
  35214. k,
  35215. pr,
  35216. r,
  35217. rm,
  35218. s,
  35219. x = this,
  35220. Ctor = x.constructor,
  35221. yn = +(y = new Ctor(y));
  35222. // Either ±Infinity, NaN or ±0?
  35223. if (!x.d || !y.d || !x.d[0] || !y.d[0]) return new Ctor(mathpow(+x, yn));
  35224. x = new Ctor(x);
  35225. if (x.eq(1)) return x;
  35226. pr = Ctor.precision;
  35227. rm = Ctor.rounding;
  35228. if (y.eq(1)) return finalise(x, pr, rm);
  35229. // y exponent
  35230. e = mathfloor(y.e / LOG_BASE);
  35231. // If y is a small integer use the 'exponentiation by squaring' algorithm.
  35232. if (e >= y.d.length - 1 && (k = yn < 0 ? -yn : yn) <= MAX_SAFE_INTEGER) {
  35233. r = intPow(Ctor, x, k, pr);
  35234. return y.s < 0 ? new Ctor(1).div(r) : finalise(r, pr, rm);
  35235. }
  35236. s = x.s;
  35237. // if x is negative
  35238. if (s < 0) {
  35239. // if y is not an integer
  35240. if (e < y.d.length - 1) return new Ctor(NaN);
  35241. // Result is positive if x is negative and the last digit of integer y is even.
  35242. if ((y.d[e] & 1) == 0) s = 1;
  35243. // if x.eq(-1)
  35244. if (x.e == 0 && x.d[0] == 1 && x.d.length == 1) {
  35245. x.s = s;
  35246. return x;
  35247. }
  35248. }
  35249. // Estimate result exponent.
  35250. // x^y = 10^e, where e = y * log10(x)
  35251. // log10(x) = log10(x_significand) + x_exponent
  35252. // log10(x_significand) = ln(x_significand) / ln(10)
  35253. k = mathpow(+x, yn);
  35254. e = k == 0 || !isFinite(k) ? mathfloor(yn * (Math.log('0.' + digitsToString(x.d)) / Math.LN10 + x.e + 1)) : new Ctor(k + '').e;
  35255. // Exponent estimate may be incorrect e.g. x: 0.999999999999999999, y: 2.29, e: 0, r.e: -1.
  35256. // Overflow/underflow?
  35257. if (e > Ctor.maxE + 1 || e < Ctor.minE - 1) return new Ctor(e > 0 ? s / 0 : 0);
  35258. external = false;
  35259. Ctor.rounding = x.s = 1;
  35260. // Estimate the extra guard digits needed to ensure five correct rounding digits from
  35261. // naturalLogarithm(x). Example of failure without these extra digits (precision: 10):
  35262. // new Decimal(2.32456).pow('2087987436534566.46411')
  35263. // should be 1.162377823e+764914905173815, but is 1.162355823e+764914905173815
  35264. k = Math.min(12, (e + '').length);
  35265. // r = x^y = exp(y*ln(x))
  35266. r = naturalExponential(y.times(naturalLogarithm(x, pr + k)), pr);
  35267. // r may be Infinity, e.g. (0.9999999999999999).pow(-1e+40)
  35268. if (r.d) {
  35269. // Truncate to the required precision plus five rounding digits.
  35270. r = finalise(r, pr + 5, 1);
  35271. // If the rounding digits are [49]9999 or [50]0000 increase the precision by 10 and recalculate
  35272. // the result.
  35273. if (checkRoundingDigits(r.d, pr, rm)) {
  35274. e = pr + 10;
  35275. // Truncate to the increased precision plus five rounding digits.
  35276. r = finalise(naturalExponential(y.times(naturalLogarithm(x, e + k)), e), e + 5, 1);
  35277. // Check for 14 nines from the 2nd rounding digit (the first rounding digit may be 4 or 9).
  35278. if (+digitsToString(r.d).slice(pr + 1, pr + 15) + 1 == 1e14) {
  35279. r = finalise(r, pr + 1, 0);
  35280. }
  35281. }
  35282. }
  35283. r.s = s;
  35284. external = true;
  35285. Ctor.rounding = rm;
  35286. return finalise(r, pr, rm);
  35287. };
  35288. /*
  35289. * Return a string representing the value of this Decimal rounded to `sd` significant digits
  35290. * using rounding mode `rounding`.
  35291. *
  35292. * Return exponential notation if `sd` is less than the number of digits necessary to represent
  35293. * the integer part of the value in normal notation.
  35294. *
  35295. * [sd] {number} Significant digits. Integer, 1 to MAX_DIGITS inclusive.
  35296. * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.
  35297. *
  35298. */
  35299. P.toPrecision = function (sd, rm) {
  35300. var str,
  35301. x = this,
  35302. Ctor = x.constructor;
  35303. if (sd === void 0) {
  35304. str = finiteToString(x, x.e <= Ctor.toExpNeg || x.e >= Ctor.toExpPos);
  35305. } else {
  35306. checkInt32(sd, 1, MAX_DIGITS);
  35307. if (rm === void 0) rm = Ctor.rounding;else checkInt32(rm, 0, 8);
  35308. x = finalise(new Ctor(x), sd, rm);
  35309. str = finiteToString(x, sd <= x.e || x.e <= Ctor.toExpNeg, sd);
  35310. }
  35311. return x.isNeg() && !x.isZero() ? '-' + str : str;
  35312. };
  35313. /*
  35314. * Return a new Decimal whose value is the value of this Decimal rounded to a maximum of `sd`
  35315. * significant digits using rounding mode `rm`, or to `precision` and `rounding` respectively if
  35316. * omitted.
  35317. *
  35318. * [sd] {number} Significant digits. Integer, 1 to MAX_DIGITS inclusive.
  35319. * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.
  35320. *
  35321. * 'toSD() digits out of range: {sd}'
  35322. * 'toSD() digits not an integer: {sd}'
  35323. * 'toSD() rounding mode not an integer: {rm}'
  35324. * 'toSD() rounding mode out of range: {rm}'
  35325. *
  35326. */
  35327. P.toSignificantDigits = P.toSD = function (sd, rm) {
  35328. var x = this,
  35329. Ctor = x.constructor;
  35330. if (sd === void 0) {
  35331. sd = Ctor.precision;
  35332. rm = Ctor.rounding;
  35333. } else {
  35334. checkInt32(sd, 1, MAX_DIGITS);
  35335. if (rm === void 0) rm = Ctor.rounding;else checkInt32(rm, 0, 8);
  35336. }
  35337. return finalise(new Ctor(x), sd, rm);
  35338. };
  35339. /*
  35340. * Return a string representing the value of this Decimal.
  35341. *
  35342. * Return exponential notation if this Decimal has a positive exponent equal to or greater than
  35343. * `toExpPos`, or a negative exponent equal to or less than `toExpNeg`.
  35344. *
  35345. */
  35346. P.toString = function () {
  35347. var x = this,
  35348. Ctor = x.constructor,
  35349. str = finiteToString(x, x.e <= Ctor.toExpNeg || x.e >= Ctor.toExpPos);
  35350. return x.isNeg() && !x.isZero() ? '-' + str : str;
  35351. };
  35352. /*
  35353. * Return a new Decimal whose value is the value of this Decimal truncated to a whole number.
  35354. *
  35355. */
  35356. P.truncated = P.trunc = function () {
  35357. return finalise(new this.constructor(this), this.e + 1, 1);
  35358. };
  35359. /*
  35360. * Return a string representing the value of this Decimal.
  35361. * Unlike `toString`, negative zero will include the minus sign.
  35362. *
  35363. */
  35364. P.valueOf = P.toJSON = function () {
  35365. var x = this,
  35366. Ctor = x.constructor,
  35367. str = finiteToString(x, x.e <= Ctor.toExpNeg || x.e >= Ctor.toExpPos);
  35368. return x.isNeg() ? '-' + str : str;
  35369. };
  35370. /*
  35371. // Add aliases to match BigDecimal method names.
  35372. // P.add = P.plus;
  35373. P.subtract = P.minus;
  35374. P.multiply = P.times;
  35375. P.divide = P.div;
  35376. P.remainder = P.mod;
  35377. P.compareTo = P.cmp;
  35378. P.negate = P.neg;
  35379. */
  35380. // Helper functions for Decimal.prototype (P) and/or Decimal methods, and their callers.
  35381. /*
  35382. * digitsToString P.cubeRoot, P.logarithm, P.squareRoot, P.toFraction, P.toPower,
  35383. * finiteToString, naturalExponential, naturalLogarithm
  35384. * checkInt32 P.toDecimalPlaces, P.toExponential, P.toFixed, P.toNearest,
  35385. * P.toPrecision, P.toSignificantDigits, toStringBinary, random
  35386. * checkRoundingDigits P.logarithm, P.toPower, naturalExponential, naturalLogarithm
  35387. * convertBase toStringBinary, parseOther
  35388. * cos P.cos
  35389. * divide P.atanh, P.cubeRoot, P.dividedBy, P.dividedToIntegerBy,
  35390. * P.logarithm, P.modulo, P.squareRoot, P.tan, P.tanh, P.toFraction,
  35391. * P.toNearest, toStringBinary, naturalExponential, naturalLogarithm,
  35392. * taylorSeries, atan2, parseOther
  35393. * finalise P.absoluteValue, P.atan, P.atanh, P.ceil, P.cos, P.cosh,
  35394. * P.cubeRoot, P.dividedToIntegerBy, P.floor, P.logarithm, P.minus,
  35395. * P.modulo, P.negated, P.plus, P.round, P.sin, P.sinh, P.squareRoot,
  35396. * P.tan, P.times, P.toDecimalPlaces, P.toExponential, P.toFixed,
  35397. * P.toNearest, P.toPower, P.toPrecision, P.toSignificantDigits,
  35398. * P.truncated, divide, getLn10, getPi, naturalExponential,
  35399. * naturalLogarithm, ceil, floor, round, trunc
  35400. * finiteToString P.toExponential, P.toFixed, P.toPrecision, P.toString, P.valueOf,
  35401. * toStringBinary
  35402. * getBase10Exponent P.minus, P.plus, P.times, parseOther
  35403. * getLn10 P.logarithm, naturalLogarithm
  35404. * getPi P.acos, P.asin, P.atan, toLessThanHalfPi, atan2
  35405. * getPrecision P.precision, P.toFraction
  35406. * getZeroString digitsToString, finiteToString
  35407. * intPow P.toPower, parseOther
  35408. * isOdd toLessThanHalfPi
  35409. * maxOrMin max, min
  35410. * naturalExponential P.naturalExponential, P.toPower
  35411. * naturalLogarithm P.acosh, P.asinh, P.atanh, P.logarithm, P.naturalLogarithm,
  35412. * P.toPower, naturalExponential
  35413. * nonFiniteToString finiteToString, toStringBinary
  35414. * parseDecimal Decimal
  35415. * parseOther Decimal
  35416. * sin P.sin
  35417. * taylorSeries P.cosh, P.sinh, cos, sin
  35418. * toLessThanHalfPi P.cos, P.sin
  35419. * toStringBinary P.toBinary, P.toHexadecimal, P.toOctal
  35420. * truncate intPow
  35421. *
  35422. * Throws: P.logarithm, P.precision, P.toFraction, checkInt32, getLn10, getPi,
  35423. * naturalLogarithm, config, parseOther, random, Decimal
  35424. */
  35425. function digitsToString(d) {
  35426. var i,
  35427. k,
  35428. ws,
  35429. indexOfLastWord = d.length - 1,
  35430. str = '',
  35431. w = d[0];
  35432. if (indexOfLastWord > 0) {
  35433. str += w;
  35434. for (i = 1; i < indexOfLastWord; i++) {
  35435. ws = d[i] + '';
  35436. k = LOG_BASE - ws.length;
  35437. if (k) str += getZeroString(k);
  35438. str += ws;
  35439. }
  35440. w = d[i];
  35441. ws = w + '';
  35442. k = LOG_BASE - ws.length;
  35443. if (k) str += getZeroString(k);
  35444. } else if (w === 0) {
  35445. return '0';
  35446. }
  35447. // Remove trailing zeros of last w.
  35448. for (; w % 10 === 0;) {
  35449. w /= 10;
  35450. }return str + w;
  35451. }
  35452. function checkInt32(i, min, max) {
  35453. if (i !== ~~i || i < min || i > max) {
  35454. throw Error(invalidArgument + i);
  35455. }
  35456. }
  35457. /*
  35458. * Check 5 rounding digits if `repeating` is null, 4 otherwise.
  35459. * `repeating == null` if caller is `log` or `pow`,
  35460. * `repeating != null` if caller is `naturalLogarithm` or `naturalExponential`.
  35461. */
  35462. function checkRoundingDigits(d, i, rm, repeating) {
  35463. var di, k, r, rd;
  35464. // Get the length of the first word of the array d.
  35465. for (k = d[0]; k >= 10; k /= 10) {
  35466. --i;
  35467. } // Is the rounding digit in the first word of d?
  35468. if (--i < 0) {
  35469. i += LOG_BASE;
  35470. di = 0;
  35471. } else {
  35472. di = Math.ceil((i + 1) / LOG_BASE);
  35473. i %= LOG_BASE;
  35474. }
  35475. // i is the index (0 - 6) of the rounding digit.
  35476. // E.g. if within the word 3487563 the first rounding digit is 5,
  35477. // then i = 4, k = 1000, rd = 3487563 % 1000 = 563
  35478. k = mathpow(10, LOG_BASE - i);
  35479. rd = d[di] % k | 0;
  35480. if (repeating == null) {
  35481. if (i < 3) {
  35482. if (i == 0) rd = rd / 100 | 0;else if (i == 1) rd = rd / 10 | 0;
  35483. r = rm < 4 && rd == 99999 || rm > 3 && rd == 49999 || rd == 50000 || rd == 0;
  35484. } else {
  35485. 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;
  35486. }
  35487. } else {
  35488. if (i < 4) {
  35489. if (i == 0) rd = rd / 1000 | 0;else if (i == 1) rd = rd / 100 | 0;else if (i == 2) rd = rd / 10 | 0;
  35490. r = (repeating || rm < 4) && rd == 9999 || !repeating && rm > 3 && rd == 4999;
  35491. } else {
  35492. 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;
  35493. }
  35494. }
  35495. return r;
  35496. }
  35497. // Convert string of `baseIn` to an array of numbers of `baseOut`.
  35498. // Eg. convertBase('255', 10, 16) returns [15, 15].
  35499. // Eg. convertBase('ff', 16, 10) returns [2, 5, 5].
  35500. function convertBase(str, baseIn, baseOut) {
  35501. var j,
  35502. arr = [0],
  35503. arrL,
  35504. i = 0,
  35505. strL = str.length;
  35506. for (; i < strL;) {
  35507. for (arrL = arr.length; arrL--;) {
  35508. arr[arrL] *= baseIn;
  35509. }arr[0] += NUMERALS.indexOf(str.charAt(i++));
  35510. for (j = 0; j < arr.length; j++) {
  35511. if (arr[j] > baseOut - 1) {
  35512. if (arr[j + 1] === void 0) arr[j + 1] = 0;
  35513. arr[j + 1] += arr[j] / baseOut | 0;
  35514. arr[j] %= baseOut;
  35515. }
  35516. }
  35517. }
  35518. return arr.reverse();
  35519. }
  35520. /*
  35521. * cos(x) = 1 - x^2/2! + x^4/4! - ...
  35522. * |x| < pi/2
  35523. *
  35524. */
  35525. function cosine(Ctor, x) {
  35526. var k,
  35527. y,
  35528. len = x.d.length;
  35529. // Argument reduction: cos(4x) = 8*(cos^4(x) - cos^2(x)) + 1
  35530. // i.e. cos(x) = 8*(cos^4(x/4) - cos^2(x/4)) + 1
  35531. // Estimate the optimum number of times to use the argument reduction.
  35532. if (len < 32) {
  35533. k = Math.ceil(len / 3);
  35534. y = Math.pow(4, -k).toString();
  35535. } else {
  35536. k = 16;
  35537. y = '2.3283064365386962890625e-10';
  35538. }
  35539. Ctor.precision += k;
  35540. x = taylorSeries(Ctor, 1, x.times(y), new Ctor(1));
  35541. // Reverse argument reduction
  35542. for (var i = k; i--;) {
  35543. var cos2x = x.times(x);
  35544. x = cos2x.times(cos2x).minus(cos2x).times(8).plus(1);
  35545. }
  35546. Ctor.precision -= k;
  35547. return x;
  35548. }
  35549. /*
  35550. * Perform division in the specified base.
  35551. */
  35552. var divide = function () {
  35553. // Assumes non-zero x and k, and hence non-zero result.
  35554. function multiplyInteger(x, k, base) {
  35555. var temp,
  35556. carry = 0,
  35557. i = x.length;
  35558. for (x = x.slice(); i--;) {
  35559. temp = x[i] * k + carry;
  35560. x[i] = temp % base | 0;
  35561. carry = temp / base | 0;
  35562. }
  35563. if (carry) x.unshift(carry);
  35564. return x;
  35565. }
  35566. function compare(a, b, aL, bL) {
  35567. var i, r;
  35568. if (aL != bL) {
  35569. r = aL > bL ? 1 : -1;
  35570. } else {
  35571. for (i = r = 0; i < aL; i++) {
  35572. if (a[i] != b[i]) {
  35573. r = a[i] > b[i] ? 1 : -1;
  35574. break;
  35575. }
  35576. }
  35577. }
  35578. return r;
  35579. }
  35580. function subtract(a, b, aL, base) {
  35581. var i = 0;
  35582. // Subtract b from a.
  35583. for (; aL--;) {
  35584. a[aL] -= i;
  35585. i = a[aL] < b[aL] ? 1 : 0;
  35586. a[aL] = i * base + a[aL] - b[aL];
  35587. }
  35588. // Remove leading zeros.
  35589. for (; !a[0] && a.length > 1;) {
  35590. a.shift();
  35591. }
  35592. }
  35593. return function (x, y, pr, rm, dp, base) {
  35594. var cmp,
  35595. e,
  35596. i,
  35597. k,
  35598. logBase,
  35599. more,
  35600. prod,
  35601. prodL,
  35602. q,
  35603. qd,
  35604. rem,
  35605. remL,
  35606. rem0,
  35607. sd,
  35608. t,
  35609. xi,
  35610. xL,
  35611. yd0,
  35612. yL,
  35613. yz,
  35614. Ctor = x.constructor,
  35615. sign = x.s == y.s ? 1 : -1,
  35616. xd = x.d,
  35617. yd = y.d;
  35618. // Either NaN, Infinity or 0?
  35619. if (!xd || !xd[0] || !yd || !yd[0]) {
  35620. return new Ctor( // Return NaN if either NaN, or both Infinity or 0.
  35621. !x.s || !y.s || (xd ? yd && xd[0] == yd[0] : !yd) ? NaN :
  35622. // Return ±0 if x is 0 or y is ±Infinity, or return ±Infinity as y is 0.
  35623. xd && xd[0] == 0 || !yd ? sign * 0 : sign / 0);
  35624. }
  35625. if (base) {
  35626. logBase = 1;
  35627. e = x.e - y.e;
  35628. } else {
  35629. base = BASE;
  35630. logBase = LOG_BASE;
  35631. e = mathfloor(x.e / logBase) - mathfloor(y.e / logBase);
  35632. }
  35633. yL = yd.length;
  35634. xL = xd.length;
  35635. q = new Ctor(sign);
  35636. qd = q.d = [];
  35637. // Result exponent may be one less than e.
  35638. // The digit array of a Decimal from toStringBinary may have trailing zeros.
  35639. for (i = 0; yd[i] == (xd[i] || 0); i++) {}
  35640. if (yd[i] > (xd[i] || 0)) e--;
  35641. if (pr == null) {
  35642. sd = pr = Ctor.precision;
  35643. rm = Ctor.rounding;
  35644. } else if (dp) {
  35645. sd = pr + (x.e - y.e) + 1;
  35646. } else {
  35647. sd = pr;
  35648. }
  35649. if (sd < 0) {
  35650. qd.push(1);
  35651. more = true;
  35652. } else {
  35653. // Convert precision in number of base 10 digits to base 1e7 digits.
  35654. sd = sd / logBase + 2 | 0;
  35655. i = 0;
  35656. // divisor < 1e7
  35657. if (yL == 1) {
  35658. k = 0;
  35659. yd = yd[0];
  35660. sd++;
  35661. // k is the carry.
  35662. for (; (i < xL || k) && sd--; i++) {
  35663. t = k * base + (xd[i] || 0);
  35664. qd[i] = t / yd | 0;
  35665. k = t % yd | 0;
  35666. }
  35667. more = k || i < xL;
  35668. // divisor >= 1e7
  35669. } else {
  35670. // Normalise xd and yd so highest order digit of yd is >= base/2
  35671. k = base / (yd[0] + 1) | 0;
  35672. if (k > 1) {
  35673. yd = multiplyInteger(yd, k, base);
  35674. xd = multiplyInteger(xd, k, base);
  35675. yL = yd.length;
  35676. xL = xd.length;
  35677. }
  35678. xi = yL;
  35679. rem = xd.slice(0, yL);
  35680. remL = rem.length;
  35681. // Add zeros to make remainder as long as divisor.
  35682. for (; remL < yL;) {
  35683. rem[remL++] = 0;
  35684. }yz = yd.slice();
  35685. yz.unshift(0);
  35686. yd0 = yd[0];
  35687. if (yd[1] >= base / 2) ++yd0;
  35688. do {
  35689. k = 0;
  35690. // Compare divisor and remainder.
  35691. cmp = compare(yd, rem, yL, remL);
  35692. // If divisor < remainder.
  35693. if (cmp < 0) {
  35694. // Calculate trial digit, k.
  35695. rem0 = rem[0];
  35696. if (yL != remL) rem0 = rem0 * base + (rem[1] || 0);
  35697. // k will be how many times the divisor goes into the current remainder.
  35698. k = rem0 / yd0 | 0;
  35699. // Algorithm:
  35700. // 1. product = divisor * trial digit (k)
  35701. // 2. if product > remainder: product -= divisor, k--
  35702. // 3. remainder -= product
  35703. // 4. if product was < remainder at 2:
  35704. // 5. compare new remainder and divisor
  35705. // 6. If remainder > divisor: remainder -= divisor, k++
  35706. if (k > 1) {
  35707. if (k >= base) k = base - 1;
  35708. // product = divisor * trial digit.
  35709. prod = multiplyInteger(yd, k, base);
  35710. prodL = prod.length;
  35711. remL = rem.length;
  35712. // Compare product and remainder.
  35713. cmp = compare(prod, rem, prodL, remL);
  35714. // product > remainder.
  35715. if (cmp == 1) {
  35716. k--;
  35717. // Subtract divisor from product.
  35718. subtract(prod, yL < prodL ? yz : yd, prodL, base);
  35719. }
  35720. } else {
  35721. // cmp is -1.
  35722. // If k is 0, there is no need to compare yd and rem again below, so change cmp to 1
  35723. // to avoid it. If k is 1 there is a need to compare yd and rem again below.
  35724. if (k == 0) cmp = k = 1;
  35725. prod = yd.slice();
  35726. }
  35727. prodL = prod.length;
  35728. if (prodL < remL) prod.unshift(0);
  35729. // Subtract product from remainder.
  35730. subtract(rem, prod, remL, base);
  35731. // If product was < previous remainder.
  35732. if (cmp == -1) {
  35733. remL = rem.length;
  35734. // Compare divisor and new remainder.
  35735. cmp = compare(yd, rem, yL, remL);
  35736. // If divisor < new remainder, subtract divisor from remainder.
  35737. if (cmp < 1) {
  35738. k++;
  35739. // Subtract divisor from remainder.
  35740. subtract(rem, yL < remL ? yz : yd, remL, base);
  35741. }
  35742. }
  35743. remL = rem.length;
  35744. } else if (cmp === 0) {
  35745. k++;
  35746. rem = [0];
  35747. } // if cmp === 1, k will be 0
  35748. // Add the next digit, k, to the result array.
  35749. qd[i++] = k;
  35750. // Update the remainder.
  35751. if (cmp && rem[0]) {
  35752. rem[remL++] = xd[xi] || 0;
  35753. } else {
  35754. rem = [xd[xi]];
  35755. remL = 1;
  35756. }
  35757. } while ((xi++ < xL || rem[0] !== void 0) && sd--);
  35758. more = rem[0] !== void 0;
  35759. }
  35760. // Leading zero?
  35761. if (!qd[0]) qd.shift();
  35762. }
  35763. // logBase is 1 when divide is being used for base conversion.
  35764. if (logBase == 1) {
  35765. q.e = e;
  35766. inexact = more;
  35767. } else {
  35768. // To calculate q.e, first get the number of digits of qd[0].
  35769. for (i = 1, k = qd[0]; k >= 10; k /= 10) {
  35770. i++;
  35771. }q.e = i + e * logBase - 1;
  35772. finalise(q, dp ? pr + q.e + 1 : pr, rm, more);
  35773. }
  35774. return q;
  35775. };
  35776. }();
  35777. /*
  35778. * Round `x` to `sd` significant digits using rounding mode `rm`.
  35779. * Check for over/under-flow.
  35780. */
  35781. function finalise(x, sd, rm, isTruncated) {
  35782. var digits,
  35783. i,
  35784. j,
  35785. k,
  35786. rd,
  35787. roundUp,
  35788. w,
  35789. xd,
  35790. xdi,
  35791. Ctor = x.constructor;
  35792. // Don't round if sd is null or undefined.
  35793. out: if (sd != null) {
  35794. xd = x.d;
  35795. // Infinity/NaN.
  35796. if (!xd) return x;
  35797. // rd: the rounding digit, i.e. the digit after the digit that may be rounded up.
  35798. // w: the word of xd containing rd, a base 1e7 number.
  35799. // xdi: the index of w within xd.
  35800. // digits: the number of digits of w.
  35801. // i: what would be the index of rd within w if all the numbers were 7 digits long (i.e. if
  35802. // they had leading zeros)
  35803. // j: if > 0, the actual index of rd within w (if < 0, rd is a leading zero).
  35804. // Get the length of the first word of the digits array xd.
  35805. for (digits = 1, k = xd[0]; k >= 10; k /= 10) {
  35806. digits++;
  35807. }i = sd - digits;
  35808. // Is the rounding digit in the first word of xd?
  35809. if (i < 0) {
  35810. i += LOG_BASE;
  35811. j = sd;
  35812. w = xd[xdi = 0];
  35813. // Get the rounding digit at index j of w.
  35814. rd = w / mathpow(10, digits - j - 1) % 10 | 0;
  35815. } else {
  35816. xdi = Math.ceil((i + 1) / LOG_BASE);
  35817. k = xd.length;
  35818. if (xdi >= k) {
  35819. if (isTruncated) {
  35820. // Needed by `naturalExponential`, `naturalLogarithm` and `squareRoot`.
  35821. for (; k++ <= xdi;) {
  35822. xd.push(0);
  35823. }w = rd = 0;
  35824. digits = 1;
  35825. i %= LOG_BASE;
  35826. j = i - LOG_BASE + 1;
  35827. } else {
  35828. break out;
  35829. }
  35830. } else {
  35831. w = k = xd[xdi];
  35832. // Get the number of digits of w.
  35833. for (digits = 1; k >= 10; k /= 10) {
  35834. digits++;
  35835. } // Get the index of rd within w.
  35836. i %= LOG_BASE;
  35837. // Get the index of rd within w, adjusted for leading zeros.
  35838. // The number of leading zeros of w is given by LOG_BASE - digits.
  35839. j = i - LOG_BASE + digits;
  35840. // Get the rounding digit at index j of w.
  35841. rd = j < 0 ? 0 : w / mathpow(10, digits - j - 1) % 10 | 0;
  35842. }
  35843. }
  35844. // Are there any non-zero digits after the rounding digit?
  35845. isTruncated = isTruncated || sd < 0 || xd[xdi + 1] !== void 0 || (j < 0 ? w : w % mathpow(10, digits - j - 1));
  35846. // The expression `w % mathpow(10, digits - j - 1)` returns all the digits of w to the right
  35847. // of the digit at (left-to-right) index j, e.g. if w is 908714 and j is 2, the expression
  35848. // will give 714.
  35849. roundUp = rm < 4 ? (rd || isTruncated) && (rm == 0 || rm == (x.s < 0 ? 3 : 2)) : rd > 5 || rd == 5 && (rm == 4 || isTruncated || rm == 6 &&
  35850. // Check whether the digit to the left of the rounding digit is odd.
  35851. (i > 0 ? j > 0 ? w / mathpow(10, digits - j) : 0 : xd[xdi - 1]) % 10 & 1 || rm == (x.s < 0 ? 8 : 7));
  35852. if (sd < 1 || !xd[0]) {
  35853. xd.length = 0;
  35854. if (roundUp) {
  35855. // Convert sd to decimal places.
  35856. sd -= x.e + 1;
  35857. // 1, 0.1, 0.01, 0.001, 0.0001 etc.
  35858. xd[0] = mathpow(10, (LOG_BASE - sd % LOG_BASE) % LOG_BASE);
  35859. x.e = -sd || 0;
  35860. } else {
  35861. // Zero.
  35862. xd[0] = x.e = 0;
  35863. }
  35864. return x;
  35865. }
  35866. // Remove excess digits.
  35867. if (i == 0) {
  35868. xd.length = xdi;
  35869. k = 1;
  35870. xdi--;
  35871. } else {
  35872. xd.length = xdi + 1;
  35873. k = mathpow(10, LOG_BASE - i);
  35874. // E.g. 56700 becomes 56000 if 7 is the rounding digit.
  35875. // j > 0 means i > number of leading zeros of w.
  35876. xd[xdi] = j > 0 ? (w / mathpow(10, digits - j) % mathpow(10, j) | 0) * k : 0;
  35877. }
  35878. if (roundUp) {
  35879. for (;;) {
  35880. // Is the digit to be rounded up in the first word of xd?
  35881. if (xdi == 0) {
  35882. // i will be the length of xd[0] before k is added.
  35883. for (i = 1, j = xd[0]; j >= 10; j /= 10) {
  35884. i++;
  35885. }j = xd[0] += k;
  35886. for (k = 1; j >= 10; j /= 10) {
  35887. k++;
  35888. } // if i != k the length has increased.
  35889. if (i != k) {
  35890. x.e++;
  35891. if (xd[0] == BASE) xd[0] = 1;
  35892. }
  35893. break;
  35894. } else {
  35895. xd[xdi] += k;
  35896. if (xd[xdi] != BASE) break;
  35897. xd[xdi--] = 0;
  35898. k = 1;
  35899. }
  35900. }
  35901. }
  35902. // Remove trailing zeros.
  35903. for (i = xd.length; xd[--i] === 0;) {
  35904. xd.pop();
  35905. }
  35906. }
  35907. if (external) {
  35908. // Overflow?
  35909. if (x.e > Ctor.maxE) {
  35910. // Infinity.
  35911. x.d = null;
  35912. x.e = NaN;
  35913. // Underflow?
  35914. } else if (x.e < Ctor.minE) {
  35915. // Zero.
  35916. x.e = 0;
  35917. x.d = [0];
  35918. // Ctor.underflow = true;
  35919. } // else Ctor.underflow = false;
  35920. }
  35921. return x;
  35922. }
  35923. function finiteToString(x, isExp, sd) {
  35924. if (!x.isFinite()) return nonFiniteToString(x);
  35925. var k,
  35926. e = x.e,
  35927. str = digitsToString(x.d),
  35928. len = str.length;
  35929. if (isExp) {
  35930. if (sd && (k = sd - len) > 0) {
  35931. str = str.charAt(0) + '.' + str.slice(1) + getZeroString(k);
  35932. } else if (len > 1) {
  35933. str = str.charAt(0) + '.' + str.slice(1);
  35934. }
  35935. str = str + (x.e < 0 ? 'e' : 'e+') + x.e;
  35936. } else if (e < 0) {
  35937. str = '0.' + getZeroString(-e - 1) + str;
  35938. if (sd && (k = sd - len) > 0) str += getZeroString(k);
  35939. } else if (e >= len) {
  35940. str += getZeroString(e + 1 - len);
  35941. if (sd && (k = sd - e - 1) > 0) str = str + '.' + getZeroString(k);
  35942. } else {
  35943. if ((k = e + 1) < len) str = str.slice(0, k) + '.' + str.slice(k);
  35944. if (sd && (k = sd - len) > 0) {
  35945. if (e + 1 === len) str += '.';
  35946. str += getZeroString(k);
  35947. }
  35948. }
  35949. return str;
  35950. }
  35951. // Calculate the base 10 exponent from the base 1e7 exponent.
  35952. function getBase10Exponent(digits, e) {
  35953. var w = digits[0];
  35954. // Add the number of digits of the first word of the digits array.
  35955. for (e *= LOG_BASE; w >= 10; w /= 10) {
  35956. e++;
  35957. }return e;
  35958. }
  35959. function getLn10(Ctor, sd, pr) {
  35960. if (sd > LN10_PRECISION) {
  35961. // Reset global state in case the exception is caught.
  35962. external = true;
  35963. if (pr) Ctor.precision = pr;
  35964. throw Error(precisionLimitExceeded);
  35965. }
  35966. return finalise(new Ctor(LN10), sd, 1, true);
  35967. }
  35968. function getPi(Ctor, sd, rm) {
  35969. if (sd > PI_PRECISION) throw Error(precisionLimitExceeded);
  35970. return finalise(new Ctor(PI), sd, rm, true);
  35971. }
  35972. function getPrecision(digits) {
  35973. var w = digits.length - 1,
  35974. len = w * LOG_BASE + 1;
  35975. w = digits[w];
  35976. // If non-zero...
  35977. if (w) {
  35978. // Subtract the number of trailing zeros of the last word.
  35979. for (; w % 10 == 0; w /= 10) {
  35980. len--;
  35981. } // Add the number of digits of the first word.
  35982. for (w = digits[0]; w >= 10; w /= 10) {
  35983. len++;
  35984. }
  35985. }
  35986. return len;
  35987. }
  35988. function getZeroString(k) {
  35989. var zs = '';
  35990. for (; k--;) {
  35991. zs += '0';
  35992. }return zs;
  35993. }
  35994. /*
  35995. * Return a new Decimal whose value is the value of Decimal `x` to the power `n`, where `n` is an
  35996. * integer of type number.
  35997. *
  35998. * Implements 'exponentiation by squaring'. Called by `pow` and `parseOther`.
  35999. *
  36000. */
  36001. function intPow(Ctor, x, n, pr) {
  36002. var isTruncated,
  36003. r = new Ctor(1),
  36004. // Max n of 9007199254740991 takes 53 loop iterations.
  36005. // Maximum digits array length; leaves [28, 34] guard digits.
  36006. k = Math.ceil(pr / LOG_BASE + 4);
  36007. external = false;
  36008. for (;;) {
  36009. if (n % 2) {
  36010. r = r.times(x);
  36011. if (truncate(r.d, k)) isTruncated = true;
  36012. }
  36013. n = mathfloor(n / 2);
  36014. if (n === 0) {
  36015. // To ensure correct rounding when r.d is truncated, increment the last word if it is zero.
  36016. n = r.d.length - 1;
  36017. if (isTruncated && r.d[n] === 0) ++r.d[n];
  36018. break;
  36019. }
  36020. x = x.times(x);
  36021. truncate(x.d, k);
  36022. }
  36023. external = true;
  36024. return r;
  36025. }
  36026. function isOdd(n) {
  36027. return n.d[n.d.length - 1] & 1;
  36028. }
  36029. /*
  36030. * Handle `max` and `min`. `ltgt` is 'lt' or 'gt'.
  36031. */
  36032. function maxOrMin(Ctor, args, ltgt) {
  36033. var y,
  36034. x = new Ctor(args[0]),
  36035. i = 0;
  36036. for (; ++i < args.length;) {
  36037. y = new Ctor(args[i]);
  36038. if (!y.s) {
  36039. x = y;
  36040. break;
  36041. } else if (x[ltgt](y)) {
  36042. x = y;
  36043. }
  36044. }
  36045. return x;
  36046. }
  36047. /*
  36048. * Return a new Decimal whose value is the natural exponential of `x` rounded to `sd` significant
  36049. * digits.
  36050. *
  36051. * Taylor/Maclaurin series.
  36052. *
  36053. * exp(x) = x^0/0! + x^1/1! + x^2/2! + x^3/3! + ...
  36054. *
  36055. * Argument reduction:
  36056. * Repeat x = x / 32, k += 5, until |x| < 0.1
  36057. * exp(x) = exp(x / 2^k)^(2^k)
  36058. *
  36059. * Previously, the argument was initially reduced by
  36060. * exp(x) = exp(r) * 10^k where r = x - k * ln10, k = floor(x / ln10)
  36061. * to first put r in the range [0, ln10], before dividing by 32 until |x| < 0.1, but this was
  36062. * found to be slower than just dividing repeatedly by 32 as above.
  36063. *
  36064. * Max integer argument: exp('20723265836946413') = 6.3e+9000000000000000
  36065. * Min integer argument: exp('-20723265836946411') = 1.2e-9000000000000000
  36066. * (Math object integer min/max: Math.exp(709) = 8.2e+307, Math.exp(-745) = 5e-324)
  36067. *
  36068. * exp(Infinity) = Infinity
  36069. * exp(-Infinity) = 0
  36070. * exp(NaN) = NaN
  36071. * exp(±0) = 1
  36072. *
  36073. * exp(x) is non-terminating for any finite, non-zero x.
  36074. *
  36075. * The result will always be correctly rounded.
  36076. *
  36077. */
  36078. function naturalExponential(x, sd) {
  36079. var denominator,
  36080. guard,
  36081. j,
  36082. pow,
  36083. sum,
  36084. t,
  36085. wpr,
  36086. rep = 0,
  36087. i = 0,
  36088. k = 0,
  36089. Ctor = x.constructor,
  36090. rm = Ctor.rounding,
  36091. pr = Ctor.precision;
  36092. // 0/NaN/Infinity?
  36093. if (!x.d || !x.d[0] || x.e > 17) {
  36094. return new Ctor(x.d ? !x.d[0] ? 1 : x.s < 0 ? 0 : 1 / 0 : x.s ? x.s < 0 ? 0 : x : 0 / 0);
  36095. }
  36096. if (sd == null) {
  36097. external = false;
  36098. wpr = pr;
  36099. } else {
  36100. wpr = sd;
  36101. }
  36102. t = new Ctor(0.03125);
  36103. // while abs(x) >= 0.1
  36104. while (x.e > -2) {
  36105. // x = x / 2^5
  36106. x = x.times(t);
  36107. k += 5;
  36108. }
  36109. // Use 2 * log10(2^k) + 5 (empirically derived) to estimate the increase in precision
  36110. // necessary to ensure the first 4 rounding digits are correct.
  36111. guard = Math.log(mathpow(2, k)) / Math.LN10 * 2 + 5 | 0;
  36112. wpr += guard;
  36113. denominator = pow = sum = new Ctor(1);
  36114. Ctor.precision = wpr;
  36115. for (;;) {
  36116. pow = finalise(pow.times(x), wpr, 1);
  36117. denominator = denominator.times(++i);
  36118. t = sum.plus(divide(pow, denominator, wpr, 1));
  36119. if (digitsToString(t.d).slice(0, wpr) === digitsToString(sum.d).slice(0, wpr)) {
  36120. j = k;
  36121. while (j--) {
  36122. sum = finalise(sum.times(sum), wpr, 1);
  36123. } // Check to see if the first 4 rounding digits are [49]999.
  36124. // If so, repeat the summation with a higher precision, otherwise
  36125. // e.g. with precision: 18, rounding: 1
  36126. // exp(18.404272462595034083567793919843761) = 98372560.1229999999 (should be 98372560.123)
  36127. // `wpr - guard` is the index of first rounding digit.
  36128. if (sd == null) {
  36129. if (rep < 3 && checkRoundingDigits(sum.d, wpr - guard, rm, rep)) {
  36130. Ctor.precision = wpr += 10;
  36131. denominator = pow = t = new Ctor(1);
  36132. i = 0;
  36133. rep++;
  36134. } else {
  36135. return finalise(sum, Ctor.precision = pr, rm, external = true);
  36136. }
  36137. } else {
  36138. Ctor.precision = pr;
  36139. return sum;
  36140. }
  36141. }
  36142. sum = t;
  36143. }
  36144. }
  36145. /*
  36146. * Return a new Decimal whose value is the natural logarithm of `x` rounded to `sd` significant
  36147. * digits.
  36148. *
  36149. * ln(-n) = NaN
  36150. * ln(0) = -Infinity
  36151. * ln(-0) = -Infinity
  36152. * ln(1) = 0
  36153. * ln(Infinity) = Infinity
  36154. * ln(-Infinity) = NaN
  36155. * ln(NaN) = NaN
  36156. *
  36157. * ln(n) (n != 1) is non-terminating.
  36158. *
  36159. */
  36160. function naturalLogarithm(y, sd) {
  36161. var c,
  36162. c0,
  36163. denominator,
  36164. e,
  36165. numerator,
  36166. rep,
  36167. sum,
  36168. t,
  36169. wpr,
  36170. x1,
  36171. x2,
  36172. n = 1,
  36173. guard = 10,
  36174. x = y,
  36175. xd = x.d,
  36176. Ctor = x.constructor,
  36177. rm = Ctor.rounding,
  36178. pr = Ctor.precision;
  36179. // Is x negative or Infinity, NaN, 0 or 1?
  36180. if (x.s < 0 || !xd || !xd[0] || !x.e && xd[0] == 1 && xd.length == 1) {
  36181. return new Ctor(xd && !xd[0] ? -1 / 0 : x.s != 1 ? NaN : xd ? 0 : x);
  36182. }
  36183. if (sd == null) {
  36184. external = false;
  36185. wpr = pr;
  36186. } else {
  36187. wpr = sd;
  36188. }
  36189. Ctor.precision = wpr += guard;
  36190. c = digitsToString(xd);
  36191. c0 = c.charAt(0);
  36192. if (Math.abs(e = x.e) < 1.5e15) {
  36193. // Argument reduction.
  36194. // The series converges faster the closer the argument is to 1, so using
  36195. // ln(a^b) = b * ln(a), ln(a) = ln(a^b) / b
  36196. // multiply the argument by itself until the leading digits of the significand are 7, 8, 9,
  36197. // 10, 11, 12 or 13, recording the number of multiplications so the sum of the series can
  36198. // later be divided by this number, then separate out the power of 10 using
  36199. // ln(a*10^b) = ln(a) + b*ln(10).
  36200. // max n is 21 (gives 0.9, 1.0 or 1.1) (9e15 / 21 = 4.2e14).
  36201. //while (c0 < 9 && c0 != 1 || c0 == 1 && c.charAt(1) > 1) {
  36202. // max n is 6 (gives 0.7 - 1.3)
  36203. while (c0 < 7 && c0 != 1 || c0 == 1 && c.charAt(1) > 3) {
  36204. x = x.times(y);
  36205. c = digitsToString(x.d);
  36206. c0 = c.charAt(0);
  36207. n++;
  36208. }
  36209. e = x.e;
  36210. if (c0 > 1) {
  36211. x = new Ctor('0.' + c);
  36212. e++;
  36213. } else {
  36214. x = new Ctor(c0 + '.' + c.slice(1));
  36215. }
  36216. } else {
  36217. // The argument reduction method above may result in overflow if the argument y is a massive
  36218. // number with exponent >= 1500000000000000 (9e15 / 6 = 1.5e15), so instead recall this
  36219. // function using ln(x*10^e) = ln(x) + e*ln(10).
  36220. t = getLn10(Ctor, wpr + 2, pr).times(e + '');
  36221. x = naturalLogarithm(new Ctor(c0 + '.' + c.slice(1)), wpr - guard).plus(t);
  36222. Ctor.precision = pr;
  36223. return sd == null ? finalise(x, pr, rm, external = true) : x;
  36224. }
  36225. // x1 is x reduced to a value near 1.
  36226. x1 = x;
  36227. // Taylor series.
  36228. // ln(y) = ln((1 + x)/(1 - x)) = 2(x + x^3/3 + x^5/5 + x^7/7 + ...)
  36229. // where x = (y - 1)/(y + 1) (|x| < 1)
  36230. sum = numerator = x = divide(x.minus(1), x.plus(1), wpr, 1);
  36231. x2 = finalise(x.times(x), wpr, 1);
  36232. denominator = 3;
  36233. for (;;) {
  36234. numerator = finalise(numerator.times(x2), wpr, 1);
  36235. t = sum.plus(divide(numerator, new Ctor(denominator), wpr, 1));
  36236. if (digitsToString(t.d).slice(0, wpr) === digitsToString(sum.d).slice(0, wpr)) {
  36237. sum = sum.times(2);
  36238. // Reverse the argument reduction. Check that e is not 0 because, besides preventing an
  36239. // unnecessary calculation, -0 + 0 = +0 and to ensure correct rounding -0 needs to stay -0.
  36240. if (e !== 0) sum = sum.plus(getLn10(Ctor, wpr + 2, pr).times(e + ''));
  36241. sum = divide(sum, new Ctor(n), wpr, 1);
  36242. // Is rm > 3 and the first 4 rounding digits 4999, or rm < 4 (or the summation has
  36243. // been repeated previously) and the first 4 rounding digits 9999?
  36244. // If so, restart the summation with a higher precision, otherwise
  36245. // e.g. with precision: 12, rounding: 1
  36246. // ln(135520028.6126091714265381533) = 18.7246299999 when it should be 18.72463.
  36247. // `wpr - guard` is the index of first rounding digit.
  36248. if (sd == null) {
  36249. if (checkRoundingDigits(sum.d, wpr - guard, rm, rep)) {
  36250. Ctor.precision = wpr += guard;
  36251. t = numerator = x = divide(x1.minus(1), x1.plus(1), wpr, 1);
  36252. x2 = finalise(x.times(x), wpr, 1);
  36253. denominator = rep = 1;
  36254. } else {
  36255. return finalise(sum, Ctor.precision = pr, rm, external = true);
  36256. }
  36257. } else {
  36258. Ctor.precision = pr;
  36259. return sum;
  36260. }
  36261. }
  36262. sum = t;
  36263. denominator += 2;
  36264. }
  36265. }
  36266. // ±Infinity, NaN.
  36267. function nonFiniteToString(x) {
  36268. // Unsigned.
  36269. return String(x.s * x.s / 0);
  36270. }
  36271. /*
  36272. * Parse the value of a new Decimal `x` from string `str`.
  36273. */
  36274. function parseDecimal(x, str) {
  36275. var e, i, len;
  36276. // Decimal point?
  36277. if ((e = str.indexOf('.')) > -1) str = str.replace('.', '');
  36278. // Exponential form?
  36279. if ((i = str.search(/e/i)) > 0) {
  36280. // Determine exponent.
  36281. if (e < 0) e = i;
  36282. e += +str.slice(i + 1);
  36283. str = str.substring(0, i);
  36284. } else if (e < 0) {
  36285. // Integer.
  36286. e = str.length;
  36287. }
  36288. // Determine leading zeros.
  36289. for (i = 0; str.charCodeAt(i) === 48; i++) {}
  36290. // Determine trailing zeros.
  36291. for (len = str.length; str.charCodeAt(len - 1) === 48; --len) {}
  36292. str = str.slice(i, len);
  36293. if (str) {
  36294. len -= i;
  36295. x.e = e = e - i - 1;
  36296. x.d = [];
  36297. // Transform base
  36298. // e is the base 10 exponent.
  36299. // i is where to slice str to get the first word of the digits array.
  36300. i = (e + 1) % LOG_BASE;
  36301. if (e < 0) i += LOG_BASE;
  36302. if (i < len) {
  36303. if (i) x.d.push(+str.slice(0, i));
  36304. for (len -= LOG_BASE; i < len;) {
  36305. x.d.push(+str.slice(i, i += LOG_BASE));
  36306. }str = str.slice(i);
  36307. i = LOG_BASE - str.length;
  36308. } else {
  36309. i -= len;
  36310. }
  36311. for (; i--;) {
  36312. str += '0';
  36313. }x.d.push(+str);
  36314. if (external) {
  36315. // Overflow?
  36316. if (x.e > x.constructor.maxE) {
  36317. // Infinity.
  36318. x.d = null;
  36319. x.e = NaN;
  36320. // Underflow?
  36321. } else if (x.e < x.constructor.minE) {
  36322. // Zero.
  36323. x.e = 0;
  36324. x.d = [0];
  36325. // x.constructor.underflow = true;
  36326. } // else x.constructor.underflow = false;
  36327. }
  36328. } else {
  36329. // Zero.
  36330. x.e = 0;
  36331. x.d = [0];
  36332. }
  36333. return x;
  36334. }
  36335. /*
  36336. * Parse the value of a new Decimal `x` from a string `str`, which is not a decimal value.
  36337. */
  36338. function parseOther(x, str) {
  36339. var base, Ctor, divisor, i, isFloat, len, p, xd, xe;
  36340. if (str === 'Infinity' || str === 'NaN') {
  36341. if (!+str) x.s = NaN;
  36342. x.e = NaN;
  36343. x.d = null;
  36344. return x;
  36345. }
  36346. if (isHex.test(str)) {
  36347. base = 16;
  36348. str = str.toLowerCase();
  36349. } else if (isBinary.test(str)) {
  36350. base = 2;
  36351. } else if (isOctal.test(str)) {
  36352. base = 8;
  36353. } else {
  36354. throw Error(invalidArgument + str);
  36355. }
  36356. // Is there a binary exponent part?
  36357. i = str.search(/p/i);
  36358. if (i > 0) {
  36359. p = +str.slice(i + 1);
  36360. str = str.substring(2, i);
  36361. } else {
  36362. str = str.slice(2);
  36363. }
  36364. // Convert `str` as an integer then divide the result by `base` raised to a power such that the
  36365. // fraction part will be restored.
  36366. i = str.indexOf('.');
  36367. isFloat = i >= 0;
  36368. Ctor = x.constructor;
  36369. if (isFloat) {
  36370. str = str.replace('.', '');
  36371. len = str.length;
  36372. i = len - i;
  36373. // log[10](16) = 1.2041... , log[10](88) = 1.9444....
  36374. divisor = intPow(Ctor, new Ctor(base), i, i * 2);
  36375. }
  36376. xd = convertBase(str, base, BASE);
  36377. xe = xd.length - 1;
  36378. // Remove trailing zeros.
  36379. for (i = xe; xd[i] === 0; --i) {
  36380. xd.pop();
  36381. }if (i < 0) return new Ctor(x.s * 0);
  36382. x.e = getBase10Exponent(xd, xe);
  36383. x.d = xd;
  36384. external = false;
  36385. // At what precision to perform the division to ensure exact conversion?
  36386. // maxDecimalIntegerPartDigitCount = ceil(log[10](b) * otherBaseIntegerPartDigitCount)
  36387. // log[10](2) = 0.30103, log[10](8) = 0.90309, log[10](16) = 1.20412
  36388. // E.g. ceil(1.2 * 3) = 4, so up to 4 decimal digits are needed to represent 3 hex int digits.
  36389. // maxDecimalFractionPartDigitCount = {Hex:4|Oct:3|Bin:1} * otherBaseFractionPartDigitCount
  36390. // Therefore using 4 * the number of digits of str will always be enough.
  36391. if (isFloat) x = divide(x, divisor, len * 4);
  36392. // Multiply by the binary exponent part if present.
  36393. if (p) x = x.times(Math.abs(p) < 54 ? Math.pow(2, p) : Decimal.pow(2, p));
  36394. external = true;
  36395. return x;
  36396. }
  36397. /*
  36398. * sin(x) = x - x^3/3! + x^5/5! - ...
  36399. * |x| < pi/2
  36400. *
  36401. */
  36402. function sine(Ctor, x) {
  36403. var k,
  36404. len = x.d.length;
  36405. if (len < 3) return taylorSeries(Ctor, 2, x, x);
  36406. // Argument reduction: sin(5x) = 16*sin^5(x) - 20*sin^3(x) + 5*sin(x)
  36407. // i.e. sin(x) = 16*sin^5(x/5) - 20*sin^3(x/5) + 5*sin(x/5)
  36408. // and sin(x) = sin(x/5)(5 + sin^2(x/5)(16sin^2(x/5) - 20))
  36409. // Estimate the optimum number of times to use the argument reduction.
  36410. k = 1.4 * Math.sqrt(len);
  36411. k = k > 16 ? 16 : k | 0;
  36412. // Max k before Math.pow precision loss is 22
  36413. x = x.times(Math.pow(5, -k));
  36414. x = taylorSeries(Ctor, 2, x, x);
  36415. // Reverse argument reduction
  36416. var sin2_x,
  36417. d5 = new Ctor(5),
  36418. d16 = new Ctor(16),
  36419. d20 = new Ctor(20);
  36420. for (; k--;) {
  36421. sin2_x = x.times(x);
  36422. x = x.times(d5.plus(sin2_x.times(d16.times(sin2_x).minus(d20))));
  36423. }
  36424. return x;
  36425. }
  36426. // Calculate Taylor series for `cos`, `cosh`, `sin` and `sinh`.
  36427. function taylorSeries(Ctor, n, x, y, isHyperbolic) {
  36428. var j,
  36429. t,
  36430. u,
  36431. x2,
  36432. i = 1,
  36433. pr = Ctor.precision,
  36434. k = Math.ceil(pr / LOG_BASE);
  36435. external = false;
  36436. x2 = x.times(x);
  36437. u = new Ctor(y);
  36438. for (;;) {
  36439. t = divide(u.times(x2), new Ctor(n++ * n++), pr, 1);
  36440. u = isHyperbolic ? y.plus(t) : y.minus(t);
  36441. y = divide(t.times(x2), new Ctor(n++ * n++), pr, 1);
  36442. t = u.plus(y);
  36443. if (t.d[k] !== void 0) {
  36444. for (j = k; t.d[j] === u.d[j] && j--;) {}
  36445. if (j == -1) break;
  36446. }
  36447. j = u;
  36448. u = y;
  36449. y = t;
  36450. t = j;
  36451. i++;
  36452. }
  36453. external = true;
  36454. t.d.length = k + 1;
  36455. return t;
  36456. }
  36457. // Return the absolute value of `x` reduced to less than or equal to half pi.
  36458. function toLessThanHalfPi(Ctor, x) {
  36459. var t,
  36460. isNeg = x.s < 0,
  36461. pi = getPi(Ctor, Ctor.precision, 1),
  36462. halfPi = pi.times(0.5);
  36463. x = x.abs();
  36464. if (x.lte(halfPi)) {
  36465. quadrant = isNeg ? 4 : 1;
  36466. return x;
  36467. }
  36468. t = x.divToInt(pi);
  36469. if (t.isZero()) {
  36470. quadrant = isNeg ? 3 : 2;
  36471. } else {
  36472. x = x.minus(t.times(pi));
  36473. // 0 <= x < pi
  36474. if (x.lte(halfPi)) {
  36475. quadrant = isOdd(t) ? isNeg ? 2 : 3 : isNeg ? 4 : 1;
  36476. return x;
  36477. }
  36478. quadrant = isOdd(t) ? isNeg ? 1 : 4 : isNeg ? 3 : 2;
  36479. }
  36480. return x.minus(pi).abs();
  36481. }
  36482. /*
  36483. * Return the value of Decimal `x` as a string in base `baseOut`.
  36484. *
  36485. * If the optional `sd` argument is present include a binary exponent suffix.
  36486. */
  36487. function toStringBinary(x, baseOut, sd, rm) {
  36488. var base,
  36489. e,
  36490. i,
  36491. k,
  36492. len,
  36493. roundUp,
  36494. str,
  36495. xd,
  36496. y,
  36497. Ctor = x.constructor,
  36498. isExp = sd !== void 0;
  36499. if (isExp) {
  36500. checkInt32(sd, 1, MAX_DIGITS);
  36501. if (rm === void 0) rm = Ctor.rounding;else checkInt32(rm, 0, 8);
  36502. } else {
  36503. sd = Ctor.precision;
  36504. rm = Ctor.rounding;
  36505. }
  36506. if (!x.isFinite()) {
  36507. str = nonFiniteToString(x);
  36508. } else {
  36509. str = finiteToString(x);
  36510. i = str.indexOf('.');
  36511. // Use exponential notation according to `toExpPos` and `toExpNeg`? No, but if required:
  36512. // maxBinaryExponent = floor((decimalExponent + 1) * log[2](10))
  36513. // minBinaryExponent = floor(decimalExponent * log[2](10))
  36514. // log[2](10) = 3.321928094887362347870319429489390175864
  36515. if (isExp) {
  36516. base = 2;
  36517. if (baseOut == 16) {
  36518. sd = sd * 4 - 3;
  36519. } else if (baseOut == 8) {
  36520. sd = sd * 3 - 2;
  36521. }
  36522. } else {
  36523. base = baseOut;
  36524. }
  36525. // Convert the number as an integer then divide the result by its base raised to a power such
  36526. // that the fraction part will be restored.
  36527. // Non-integer.
  36528. if (i >= 0) {
  36529. str = str.replace('.', '');
  36530. y = new Ctor(1);
  36531. y.e = str.length - i;
  36532. y.d = convertBase(finiteToString(y), 10, base);
  36533. y.e = y.d.length;
  36534. }
  36535. xd = convertBase(str, 10, base);
  36536. e = len = xd.length;
  36537. // Remove trailing zeros.
  36538. for (; xd[--len] == 0;) {
  36539. xd.pop();
  36540. }if (!xd[0]) {
  36541. str = isExp ? '0p+0' : '0';
  36542. } else {
  36543. if (i < 0) {
  36544. e--;
  36545. } else {
  36546. x = new Ctor(x);
  36547. x.d = xd;
  36548. x.e = e;
  36549. x = divide(x, y, sd, rm, 0, base);
  36550. xd = x.d;
  36551. e = x.e;
  36552. roundUp = inexact;
  36553. }
  36554. // The rounding digit, i.e. the digit after the digit that may be rounded up.
  36555. i = xd[sd];
  36556. k = base / 2;
  36557. roundUp = roundUp || xd[sd + 1] !== void 0;
  36558. 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));
  36559. xd.length = sd;
  36560. if (roundUp) {
  36561. // Rounding up may mean the previous digit has to be rounded up and so on.
  36562. for (; ++xd[--sd] > base - 1;) {
  36563. xd[sd] = 0;
  36564. if (!sd) {
  36565. ++e;
  36566. xd.unshift(1);
  36567. }
  36568. }
  36569. }
  36570. // Determine trailing zeros.
  36571. for (len = xd.length; !xd[len - 1]; --len) {}
  36572. // E.g. [4, 11, 15] becomes 4bf.
  36573. for (i = 0, str = ''; i < len; i++) {
  36574. str += NUMERALS.charAt(xd[i]);
  36575. } // Add binary exponent suffix?
  36576. if (isExp) {
  36577. if (len > 1) {
  36578. if (baseOut == 16 || baseOut == 8) {
  36579. i = baseOut == 16 ? 4 : 3;
  36580. for (--len; len % i; len++) {
  36581. str += '0';
  36582. }xd = convertBase(str, base, baseOut);
  36583. for (len = xd.length; !xd[len - 1]; --len) {}
  36584. // xd[0] will always be be 1
  36585. for (i = 1, str = '1.'; i < len; i++) {
  36586. str += NUMERALS.charAt(xd[i]);
  36587. }
  36588. } else {
  36589. str = str.charAt(0) + '.' + str.slice(1);
  36590. }
  36591. }
  36592. str = str + (e < 0 ? 'p' : 'p+') + e;
  36593. } else if (e < 0) {
  36594. for (; ++e;) {
  36595. str = '0' + str;
  36596. }str = '0.' + str;
  36597. } else {
  36598. if (++e > len) for (e -= len; e--;) {
  36599. str += '0';
  36600. } else if (e < len) str = str.slice(0, e) + '.' + str.slice(e);
  36601. }
  36602. }
  36603. str = (baseOut == 16 ? '0x' : baseOut == 2 ? '0b' : baseOut == 8 ? '0o' : '') + str;
  36604. }
  36605. return x.s < 0 ? '-' + str : str;
  36606. }
  36607. // Does not strip trailing zeros.
  36608. function truncate(arr, len) {
  36609. if (arr.length > len) {
  36610. arr.length = len;
  36611. return true;
  36612. }
  36613. }
  36614. // Decimal methods
  36615. /*
  36616. * abs
  36617. * acos
  36618. * acosh
  36619. * add
  36620. * asin
  36621. * asinh
  36622. * atan
  36623. * atanh
  36624. * atan2
  36625. * cbrt
  36626. * ceil
  36627. * clone
  36628. * config
  36629. * cos
  36630. * cosh
  36631. * div
  36632. * exp
  36633. * floor
  36634. * hypot
  36635. * ln
  36636. * log
  36637. * log2
  36638. * log10
  36639. * max
  36640. * min
  36641. * mod
  36642. * mul
  36643. * pow
  36644. * random
  36645. * round
  36646. * set
  36647. * sign
  36648. * sin
  36649. * sinh
  36650. * sqrt
  36651. * sub
  36652. * tan
  36653. * tanh
  36654. * trunc
  36655. */
  36656. /*
  36657. * Return a new Decimal whose value is the absolute value of `x`.
  36658. *
  36659. * x {number|string|Decimal}
  36660. *
  36661. */
  36662. function abs(x) {
  36663. return new this(x).abs();
  36664. }
  36665. /*
  36666. * Return a new Decimal whose value is the arccosine in radians of `x`.
  36667. *
  36668. * x {number|string|Decimal}
  36669. *
  36670. */
  36671. function acos(x) {
  36672. return new this(x).acos();
  36673. }
  36674. /*
  36675. * Return a new Decimal whose value is the inverse of the hyperbolic cosine of `x`, rounded to
  36676. * `precision` significant digits using rounding mode `rounding`.
  36677. *
  36678. * x {number|string|Decimal} A value in radians.
  36679. *
  36680. */
  36681. function acosh(x) {
  36682. return new this(x).acosh();
  36683. }
  36684. /*
  36685. * Return a new Decimal whose value is the sum of `x` and `y`, rounded to `precision` significant
  36686. * digits using rounding mode `rounding`.
  36687. *
  36688. * x {number|string|Decimal}
  36689. * y {number|string|Decimal}
  36690. *
  36691. */
  36692. function add(x, y) {
  36693. return new this(x).plus(y);
  36694. }
  36695. /*
  36696. * Return a new Decimal whose value is the arcsine in radians of `x`, rounded to `precision`
  36697. * significant digits using rounding mode `rounding`.
  36698. *
  36699. * x {number|string|Decimal}
  36700. *
  36701. */
  36702. function asin(x) {
  36703. return new this(x).asin();
  36704. }
  36705. /*
  36706. * Return a new Decimal whose value is the inverse of the hyperbolic sine of `x`, rounded to
  36707. * `precision` significant digits using rounding mode `rounding`.
  36708. *
  36709. * x {number|string|Decimal} A value in radians.
  36710. *
  36711. */
  36712. function asinh(x) {
  36713. return new this(x).asinh();
  36714. }
  36715. /*
  36716. * Return a new Decimal whose value is the arctangent in radians of `x`, rounded to `precision`
  36717. * significant digits using rounding mode `rounding`.
  36718. *
  36719. * x {number|string|Decimal}
  36720. *
  36721. */
  36722. function atan(x) {
  36723. return new this(x).atan();
  36724. }
  36725. /*
  36726. * Return a new Decimal whose value is the inverse of the hyperbolic tangent of `x`, rounded to
  36727. * `precision` significant digits using rounding mode `rounding`.
  36728. *
  36729. * x {number|string|Decimal} A value in radians.
  36730. *
  36731. */
  36732. function atanh(x) {
  36733. return new this(x).atanh();
  36734. }
  36735. /*
  36736. * Return a new Decimal whose value is the arctangent in radians of `y/x` in the range -pi to pi
  36737. * (inclusive), rounded to `precision` significant digits using rounding mode `rounding`.
  36738. *
  36739. * Domain: [-Infinity, Infinity]
  36740. * Range: [-pi, pi]
  36741. *
  36742. * y {number|string|Decimal} The y-coordinate.
  36743. * x {number|string|Decimal} The x-coordinate.
  36744. *
  36745. * atan2(±0, -0) = ±pi
  36746. * atan2(±0, +0) = ±0
  36747. * atan2(±0, -x) = ±pi for x > 0
  36748. * atan2(±0, x) = ±0 for x > 0
  36749. * atan2(-y, ±0) = -pi/2 for y > 0
  36750. * atan2(y, ±0) = pi/2 for y > 0
  36751. * atan2(±y, -Infinity) = ±pi for finite y > 0
  36752. * atan2(±y, +Infinity) = ±0 for finite y > 0
  36753. * atan2(±Infinity, x) = ±pi/2 for finite x
  36754. * atan2(±Infinity, -Infinity) = ±3*pi/4
  36755. * atan2(±Infinity, +Infinity) = ±pi/4
  36756. * atan2(NaN, x) = NaN
  36757. * atan2(y, NaN) = NaN
  36758. *
  36759. */
  36760. function atan2(y, x) {
  36761. y = new this(y);
  36762. x = new this(x);
  36763. var r,
  36764. pr = this.precision,
  36765. rm = this.rounding,
  36766. wpr = pr + 4;
  36767. // Either NaN
  36768. if (!y.s || !x.s) {
  36769. r = new this(NaN);
  36770. // Both ±Infinity
  36771. } else if (!y.d && !x.d) {
  36772. r = getPi(this, wpr, 1).times(x.s > 0 ? 0.25 : 0.75);
  36773. r.s = y.s;
  36774. // x is ±Infinity or y is ±0
  36775. } else if (!x.d || y.isZero()) {
  36776. r = x.s < 0 ? getPi(this, pr, rm) : new this(0);
  36777. r.s = y.s;
  36778. // y is ±Infinity or x is ±0
  36779. } else if (!y.d || x.isZero()) {
  36780. r = getPi(this, wpr, 1).times(0.5);
  36781. r.s = y.s;
  36782. // Both non-zero and finite
  36783. } else if (x.s < 0) {
  36784. this.precision = wpr;
  36785. this.rounding = 1;
  36786. r = this.atan(divide(y, x, wpr, 1));
  36787. x = getPi(this, wpr, 1);
  36788. this.precision = pr;
  36789. this.rounding = rm;
  36790. r = y.s < 0 ? r.minus(x) : r.plus(x);
  36791. } else {
  36792. r = this.atan(divide(y, x, wpr, 1));
  36793. }
  36794. return r;
  36795. }
  36796. /*
  36797. * Return a new Decimal whose value is the cube root of `x`, rounded to `precision` significant
  36798. * digits using rounding mode `rounding`.
  36799. *
  36800. * x {number|string|Decimal}
  36801. *
  36802. */
  36803. function cbrt(x) {
  36804. return new this(x).cbrt();
  36805. }
  36806. /*
  36807. * Return a new Decimal whose value is `x` rounded to an integer using `ROUND_CEIL`.
  36808. *
  36809. * x {number|string|Decimal}
  36810. *
  36811. */
  36812. function ceil(x) {
  36813. return finalise(x = new this(x), x.e + 1, 2);
  36814. }
  36815. /*
  36816. * Configure global settings for a Decimal constructor.
  36817. *
  36818. * `obj` is an object with one or more of the following properties,
  36819. *
  36820. * precision {number}
  36821. * rounding {number}
  36822. * toExpNeg {number}
  36823. * toExpPos {number}
  36824. * maxE {number}
  36825. * minE {number}
  36826. * modulo {number}
  36827. * crypto {boolean|number}
  36828. * defaults {true}
  36829. *
  36830. * E.g. Decimal.config({ precision: 20, rounding: 4 })
  36831. *
  36832. */
  36833. function config(obj) {
  36834. if (!obj || (typeof obj === 'undefined' ? 'undefined' : _typeof(obj)) !== 'object') throw Error(decimalError + 'Object expected');
  36835. var i,
  36836. p,
  36837. v,
  36838. useDefaults = obj.defaults === true,
  36839. 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];
  36840. for (i = 0; i < ps.length; i += 3) {
  36841. if (p = ps[i], useDefaults) this[p] = DEFAULTS[p];
  36842. if ((v = obj[p]) !== void 0) {
  36843. if (mathfloor(v) === v && v >= ps[i + 1] && v <= ps[i + 2]) this[p] = v;else throw Error(invalidArgument + p + ': ' + v);
  36844. }
  36845. }
  36846. if (p = 'crypto', useDefaults) this[p] = DEFAULTS[p];
  36847. if ((v = obj[p]) !== void 0) {
  36848. if (v === true || v === false || v === 0 || v === 1) {
  36849. if (v) {
  36850. if (typeof crypto != 'undefined' && crypto && (crypto.getRandomValues || crypto.randomBytes)) {
  36851. this[p] = true;
  36852. } else {
  36853. throw Error(cryptoUnavailable);
  36854. }
  36855. } else {
  36856. this[p] = false;
  36857. }
  36858. } else {
  36859. throw Error(invalidArgument + p + ': ' + v);
  36860. }
  36861. }
  36862. return this;
  36863. }
  36864. /*
  36865. * Return a new Decimal whose value is the cosine of `x`, rounded to `precision` significant
  36866. * digits using rounding mode `rounding`.
  36867. *
  36868. * x {number|string|Decimal} A value in radians.
  36869. *
  36870. */
  36871. function cos(x) {
  36872. return new this(x).cos();
  36873. }
  36874. /*
  36875. * Return a new Decimal whose value is the hyperbolic cosine of `x`, rounded to precision
  36876. * significant digits using rounding mode `rounding`.
  36877. *
  36878. * x {number|string|Decimal} A value in radians.
  36879. *
  36880. */
  36881. function cosh(x) {
  36882. return new this(x).cosh();
  36883. }
  36884. /*
  36885. * Create and return a Decimal constructor with the same configuration properties as this Decimal
  36886. * constructor.
  36887. *
  36888. */
  36889. function clone(obj) {
  36890. var i, p, ps;
  36891. /*
  36892. * The Decimal constructor and exported function.
  36893. * Return a new Decimal instance.
  36894. *
  36895. * v {number|string|Decimal} A numeric value.
  36896. *
  36897. */
  36898. function Decimal(v) {
  36899. var e,
  36900. i,
  36901. t,
  36902. x = this;
  36903. // Decimal called without new.
  36904. if (!(x instanceof Decimal)) return new Decimal(v);
  36905. // Retain a reference to this Decimal constructor, and shadow Decimal.prototype.constructor
  36906. // which points to Object.
  36907. x.constructor = Decimal;
  36908. // Duplicate.
  36909. if (v instanceof Decimal) {
  36910. x.s = v.s;
  36911. x.e = v.e;
  36912. x.d = (v = v.d) ? v.slice() : v;
  36913. return;
  36914. }
  36915. t = typeof v === 'undefined' ? 'undefined' : _typeof(v);
  36916. if (t === 'number') {
  36917. if (v === 0) {
  36918. x.s = 1 / v < 0 ? -1 : 1;
  36919. x.e = 0;
  36920. x.d = [0];
  36921. return;
  36922. }
  36923. if (v < 0) {
  36924. v = -v;
  36925. x.s = -1;
  36926. } else {
  36927. x.s = 1;
  36928. }
  36929. // Fast path for small integers.
  36930. if (v === ~~v && v < 1e7) {
  36931. for (e = 0, i = v; i >= 10; i /= 10) {
  36932. e++;
  36933. }x.e = e;
  36934. x.d = [v];
  36935. return;
  36936. // Infinity, NaN.
  36937. } else if (v * 0 !== 0) {
  36938. if (!v) x.s = NaN;
  36939. x.e = NaN;
  36940. x.d = null;
  36941. return;
  36942. }
  36943. return parseDecimal(x, v.toString());
  36944. } else if (t !== 'string') {
  36945. throw Error(invalidArgument + v);
  36946. }
  36947. // Minus sign?
  36948. if (v.charCodeAt(0) === 45) {
  36949. v = v.slice(1);
  36950. x.s = -1;
  36951. } else {
  36952. x.s = 1;
  36953. }
  36954. return isDecimal.test(v) ? parseDecimal(x, v) : parseOther(x, v);
  36955. }
  36956. Decimal.prototype = P;
  36957. Decimal.ROUND_UP = 0;
  36958. Decimal.ROUND_DOWN = 1;
  36959. Decimal.ROUND_CEIL = 2;
  36960. Decimal.ROUND_FLOOR = 3;
  36961. Decimal.ROUND_HALF_UP = 4;
  36962. Decimal.ROUND_HALF_DOWN = 5;
  36963. Decimal.ROUND_HALF_EVEN = 6;
  36964. Decimal.ROUND_HALF_CEIL = 7;
  36965. Decimal.ROUND_HALF_FLOOR = 8;
  36966. Decimal.EUCLID = 9;
  36967. Decimal.config = Decimal.set = config;
  36968. Decimal.clone = clone;
  36969. Decimal.isDecimal = isDecimalInstance;
  36970. Decimal.abs = abs;
  36971. Decimal.acos = acos;
  36972. Decimal.acosh = acosh; // ES6
  36973. Decimal.add = add;
  36974. Decimal.asin = asin;
  36975. Decimal.asinh = asinh; // ES6
  36976. Decimal.atan = atan;
  36977. Decimal.atanh = atanh; // ES6
  36978. Decimal.atan2 = atan2;
  36979. Decimal.cbrt = cbrt; // ES6
  36980. Decimal.ceil = ceil;
  36981. Decimal.cos = cos;
  36982. Decimal.cosh = cosh; // ES6
  36983. Decimal.div = div;
  36984. Decimal.exp = exp;
  36985. Decimal.floor = floor;
  36986. Decimal.hypot = hypot; // ES6
  36987. Decimal.ln = ln;
  36988. Decimal.log = log;
  36989. Decimal.log10 = log10; // ES6
  36990. Decimal.log2 = log2; // ES6
  36991. Decimal.max = max;
  36992. Decimal.min = min;
  36993. Decimal.mod = mod;
  36994. Decimal.mul = mul;
  36995. Decimal.pow = pow;
  36996. Decimal.random = random;
  36997. Decimal.round = round;
  36998. Decimal.sign = sign; // ES6
  36999. Decimal.sin = sin;
  37000. Decimal.sinh = sinh; // ES6
  37001. Decimal.sqrt = sqrt;
  37002. Decimal.sub = sub;
  37003. Decimal.tan = tan;
  37004. Decimal.tanh = tanh; // ES6
  37005. Decimal.trunc = trunc; // ES6
  37006. if (obj === void 0) obj = {};
  37007. if (obj) {
  37008. if (obj.defaults !== true) {
  37009. ps = ['precision', 'rounding', 'toExpNeg', 'toExpPos', 'maxE', 'minE', 'modulo', 'crypto'];
  37010. for (i = 0; i < ps.length;) {
  37011. if (!obj.hasOwnProperty(p = ps[i++])) obj[p] = this[p];
  37012. }
  37013. }
  37014. }
  37015. Decimal.config(obj);
  37016. return Decimal;
  37017. }
  37018. /*
  37019. * Return a new Decimal whose value is `x` divided by `y`, rounded to `precision` significant
  37020. * digits using rounding mode `rounding`.
  37021. *
  37022. * x {number|string|Decimal}
  37023. * y {number|string|Decimal}
  37024. *
  37025. */
  37026. function div(x, y) {
  37027. return new this(x).div(y);
  37028. }
  37029. /*
  37030. * Return a new Decimal whose value is the natural exponential of `x`, rounded to `precision`
  37031. * significant digits using rounding mode `rounding`.
  37032. *
  37033. * x {number|string|Decimal} The power to which to raise the base of the natural log.
  37034. *
  37035. */
  37036. function exp(x) {
  37037. return new this(x).exp();
  37038. }
  37039. /*
  37040. * Return a new Decimal whose value is `x` round to an integer using `ROUND_FLOOR`.
  37041. *
  37042. * x {number|string|Decimal}
  37043. *
  37044. */
  37045. function floor(x) {
  37046. return finalise(x = new this(x), x.e + 1, 3);
  37047. }
  37048. /*
  37049. * Return a new Decimal whose value is the square root of the sum of the squares of the arguments,
  37050. * rounded to `precision` significant digits using rounding mode `rounding`.
  37051. *
  37052. * hypot(a, b, ...) = sqrt(a^2 + b^2 + ...)
  37053. *
  37054. */
  37055. function hypot() {
  37056. var i,
  37057. n,
  37058. t = new this(0);
  37059. external = false;
  37060. for (i = 0; i < arguments.length;) {
  37061. n = new this(arguments[i++]);
  37062. if (!n.d) {
  37063. if (n.s) {
  37064. external = true;
  37065. return new this(1 / 0);
  37066. }
  37067. t = n;
  37068. } else if (t.d) {
  37069. t = t.plus(n.times(n));
  37070. }
  37071. }
  37072. external = true;
  37073. return t.sqrt();
  37074. }
  37075. /*
  37076. * Return true if object is a Decimal instance (where Decimal is any Decimal constructor),
  37077. * otherwise return false.
  37078. *
  37079. */
  37080. function isDecimalInstance(obj) {
  37081. return obj instanceof Decimal || obj && obj.name === '[object Decimal]' || false;
  37082. }
  37083. /*
  37084. * Return a new Decimal whose value is the natural logarithm of `x`, rounded to `precision`
  37085. * significant digits using rounding mode `rounding`.
  37086. *
  37087. * x {number|string|Decimal}
  37088. *
  37089. */
  37090. function ln(x) {
  37091. return new this(x).ln();
  37092. }
  37093. /*
  37094. * Return a new Decimal whose value is the log of `x` to the base `y`, or to base 10 if no base
  37095. * is specified, rounded to `precision` significant digits using rounding mode `rounding`.
  37096. *
  37097. * log[y](x)
  37098. *
  37099. * x {number|string|Decimal} The argument of the logarithm.
  37100. * y {number|string|Decimal} The base of the logarithm.
  37101. *
  37102. */
  37103. function log(x, y) {
  37104. return new this(x).log(y);
  37105. }
  37106. /*
  37107. * Return a new Decimal whose value is the base 2 logarithm of `x`, rounded to `precision`
  37108. * significant digits using rounding mode `rounding`.
  37109. *
  37110. * x {number|string|Decimal}
  37111. *
  37112. */
  37113. function log2(x) {
  37114. return new this(x).log(2);
  37115. }
  37116. /*
  37117. * Return a new Decimal whose value is the base 10 logarithm of `x`, rounded to `precision`
  37118. * significant digits using rounding mode `rounding`.
  37119. *
  37120. * x {number|string|Decimal}
  37121. *
  37122. */
  37123. function log10(x) {
  37124. return new this(x).log(10);
  37125. }
  37126. /*
  37127. * Return a new Decimal whose value is the maximum of the arguments.
  37128. *
  37129. * arguments {number|string|Decimal}
  37130. *
  37131. */
  37132. function max() {
  37133. return maxOrMin(this, arguments, 'lt');
  37134. }
  37135. /*
  37136. * Return a new Decimal whose value is the minimum of the arguments.
  37137. *
  37138. * arguments {number|string|Decimal}
  37139. *
  37140. */
  37141. function min() {
  37142. return maxOrMin(this, arguments, 'gt');
  37143. }
  37144. /*
  37145. * Return a new Decimal whose value is `x` modulo `y`, rounded to `precision` significant digits
  37146. * using rounding mode `rounding`.
  37147. *
  37148. * x {number|string|Decimal}
  37149. * y {number|string|Decimal}
  37150. *
  37151. */
  37152. function mod(x, y) {
  37153. return new this(x).mod(y);
  37154. }
  37155. /*
  37156. * Return a new Decimal whose value is `x` multiplied by `y`, rounded to `precision` significant
  37157. * digits using rounding mode `rounding`.
  37158. *
  37159. * x {number|string|Decimal}
  37160. * y {number|string|Decimal}
  37161. *
  37162. */
  37163. function mul(x, y) {
  37164. return new this(x).mul(y);
  37165. }
  37166. /*
  37167. * Return a new Decimal whose value is `x` raised to the power `y`, rounded to precision
  37168. * significant digits using rounding mode `rounding`.
  37169. *
  37170. * x {number|string|Decimal} The base.
  37171. * y {number|string|Decimal} The exponent.
  37172. *
  37173. */
  37174. function pow(x, y) {
  37175. return new this(x).pow(y);
  37176. }
  37177. /*
  37178. * Returns a new Decimal with a random value equal to or greater than 0 and less than 1, and with
  37179. * `sd`, or `Decimal.precision` if `sd` is omitted, significant digits (or less if trailing zeros
  37180. * are produced).
  37181. *
  37182. * [sd] {number} Significant digits. Integer, 0 to MAX_DIGITS inclusive.
  37183. *
  37184. */
  37185. function random(sd) {
  37186. var d,
  37187. e,
  37188. k,
  37189. n,
  37190. i = 0,
  37191. r = new this(1),
  37192. rd = [];
  37193. if (sd === void 0) sd = this.precision;else checkInt32(sd, 1, MAX_DIGITS);
  37194. k = Math.ceil(sd / LOG_BASE);
  37195. if (!this.crypto) {
  37196. for (; i < k;) {
  37197. rd[i++] = Math.random() * 1e7 | 0;
  37198. } // Browsers supporting crypto.getRandomValues.
  37199. } else if (crypto.getRandomValues) {
  37200. d = crypto.getRandomValues(new Uint32Array(k));
  37201. for (; i < k;) {
  37202. n = d[i];
  37203. // 0 <= n < 4294967296
  37204. // Probability n >= 4.29e9, is 4967296 / 4294967296 = 0.00116 (1 in 865).
  37205. if (n >= 4.29e9) {
  37206. d[i] = crypto.getRandomValues(new Uint32Array(1))[0];
  37207. } else {
  37208. // 0 <= n <= 4289999999
  37209. // 0 <= (n % 1e7) <= 9999999
  37210. rd[i++] = n % 1e7;
  37211. }
  37212. }
  37213. // Node.js supporting crypto.randomBytes.
  37214. } else if (crypto.randomBytes) {
  37215. // buffer
  37216. d = crypto.randomBytes(k *= 4);
  37217. for (; i < k;) {
  37218. // 0 <= n < 2147483648
  37219. n = d[i] + (d[i + 1] << 8) + (d[i + 2] << 16) + ((d[i + 3] & 0x7f) << 24);
  37220. // Probability n >= 2.14e9, is 7483648 / 2147483648 = 0.0035 (1 in 286).
  37221. if (n >= 2.14e9) {
  37222. crypto.randomBytes(4).copy(d, i);
  37223. } else {
  37224. // 0 <= n <= 2139999999
  37225. // 0 <= (n % 1e7) <= 9999999
  37226. rd.push(n % 1e7);
  37227. i += 4;
  37228. }
  37229. }
  37230. i = k / 4;
  37231. } else {
  37232. throw Error(cryptoUnavailable);
  37233. }
  37234. k = rd[--i];
  37235. sd %= LOG_BASE;
  37236. // Convert trailing digits to zeros according to sd.
  37237. if (k && sd) {
  37238. n = mathpow(10, LOG_BASE - sd);
  37239. rd[i] = (k / n | 0) * n;
  37240. }
  37241. // Remove trailing words which are zero.
  37242. for (; rd[i] === 0; i--) {
  37243. rd.pop();
  37244. } // Zero?
  37245. if (i < 0) {
  37246. e = 0;
  37247. rd = [0];
  37248. } else {
  37249. e = -1;
  37250. // Remove leading words which are zero and adjust exponent accordingly.
  37251. for (; rd[0] === 0; e -= LOG_BASE) {
  37252. rd.shift();
  37253. } // Count the digits of the first word of rd to determine leading zeros.
  37254. for (k = 1, n = rd[0]; n >= 10; n /= 10) {
  37255. k++;
  37256. } // Adjust the exponent for leading zeros of the first word of rd.
  37257. if (k < LOG_BASE) e -= LOG_BASE - k;
  37258. }
  37259. r.e = e;
  37260. r.d = rd;
  37261. return r;
  37262. }
  37263. /*
  37264. * Return a new Decimal whose value is `x` rounded to an integer using rounding mode `rounding`.
  37265. *
  37266. * To emulate `Math.round`, set rounding to 7 (ROUND_HALF_CEIL).
  37267. *
  37268. * x {number|string|Decimal}
  37269. *
  37270. */
  37271. function round(x) {
  37272. return finalise(x = new this(x), x.e + 1, this.rounding);
  37273. }
  37274. /*
  37275. * Return
  37276. * 1 if x > 0,
  37277. * -1 if x < 0,
  37278. * 0 if x is 0,
  37279. * -0 if x is -0,
  37280. * NaN otherwise
  37281. *
  37282. */
  37283. function sign(x) {
  37284. x = new this(x);
  37285. return x.d ? x.d[0] ? x.s : 0 * x.s : x.s || NaN;
  37286. }
  37287. /*
  37288. * Return a new Decimal whose value is the sine of `x`, rounded to `precision` significant digits
  37289. * using rounding mode `rounding`.
  37290. *
  37291. * x {number|string|Decimal} A value in radians.
  37292. *
  37293. */
  37294. function sin(x) {
  37295. return new this(x).sin();
  37296. }
  37297. /*
  37298. * Return a new Decimal whose value is the hyperbolic sine of `x`, rounded to `precision`
  37299. * significant digits using rounding mode `rounding`.
  37300. *
  37301. * x {number|string|Decimal} A value in radians.
  37302. *
  37303. */
  37304. function sinh(x) {
  37305. return new this(x).sinh();
  37306. }
  37307. /*
  37308. * Return a new Decimal whose value is the square root of `x`, rounded to `precision` significant
  37309. * digits using rounding mode `rounding`.
  37310. *
  37311. * x {number|string|Decimal}
  37312. *
  37313. */
  37314. function sqrt(x) {
  37315. return new this(x).sqrt();
  37316. }
  37317. /*
  37318. * Return a new Decimal whose value is `x` minus `y`, rounded to `precision` significant digits
  37319. * using rounding mode `rounding`.
  37320. *
  37321. * x {number|string|Decimal}
  37322. * y {number|string|Decimal}
  37323. *
  37324. */
  37325. function sub(x, y) {
  37326. return new this(x).sub(y);
  37327. }
  37328. /*
  37329. * Return a new Decimal whose value is the tangent of `x`, rounded to `precision` significant
  37330. * digits using rounding mode `rounding`.
  37331. *
  37332. * x {number|string|Decimal} A value in radians.
  37333. *
  37334. */
  37335. function tan(x) {
  37336. return new this(x).tan();
  37337. }
  37338. /*
  37339. * Return a new Decimal whose value is the hyperbolic tangent of `x`, rounded to `precision`
  37340. * significant digits using rounding mode `rounding`.
  37341. *
  37342. * x {number|string|Decimal} A value in radians.
  37343. *
  37344. */
  37345. function tanh(x) {
  37346. return new this(x).tanh();
  37347. }
  37348. /*
  37349. * Return a new Decimal whose value is `x` truncated to an integer.
  37350. *
  37351. * x {number|string|Decimal}
  37352. *
  37353. */
  37354. function trunc(x) {
  37355. return finalise(x = new this(x), x.e + 1, 1);
  37356. }
  37357. // Create and configure initial Decimal constructor.
  37358. Decimal = clone(DEFAULTS);
  37359. Decimal['default'] = Decimal.Decimal = Decimal;
  37360. // Create the internal constants from their string values.
  37361. LN10 = new Decimal(LN10);
  37362. PI = new Decimal(PI);
  37363. // Export.
  37364. // AMD.
  37365. if (true) {
  37366. !(__WEBPACK_AMD_DEFINE_RESULT__ = (function () {
  37367. return Decimal;
  37368. }).call(exports, __webpack_require__, exports, module),
  37369. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  37370. // Node and other environments that support module.exports.
  37371. } else {}
  37372. })(undefined);
  37373. /***/ }),
  37374. /***/ "./node_modules/jquery/dist/jquery.js":
  37375. /*!********************************************!*\
  37376. !*** ./node_modules/jquery/dist/jquery.js ***!
  37377. \********************************************/
  37378. /*! no static exports found */
  37379. /***/ (function(module, exports, __webpack_require__) {
  37380. "use strict";
  37381. /* WEBPACK VAR INJECTION */(function(module) {var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;
  37382. 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; };
  37383. /*!
  37384. * jQuery JavaScript Library v3.3.1
  37385. * https://jquery.com/
  37386. *
  37387. * Includes Sizzle.js
  37388. * https://sizzlejs.com/
  37389. *
  37390. * Copyright JS Foundation and other contributors
  37391. * Released under the MIT license
  37392. * https://jquery.org/license
  37393. *
  37394. * Date: 2018-01-20T17:24Z
  37395. */
  37396. (function (global, factory) {
  37397. "use strict";
  37398. if (( false ? undefined : _typeof(module)) === "object" && _typeof(module.exports) === "object") {
  37399. // For CommonJS and CommonJS-like environments where a proper `window`
  37400. // is present, execute the factory and get jQuery.
  37401. // For environments that do not have a `window` with a `document`
  37402. // (such as Node.js), expose a factory as module.exports.
  37403. // This accentuates the need for the creation of a real `window`.
  37404. // e.g. var jQuery = require("jquery")(window);
  37405. // See ticket #14549 for more info.
  37406. module.exports = global.document ? factory(global, true) : function (w) {
  37407. if (!w.document) {
  37408. throw new Error("jQuery requires a window with a document");
  37409. }
  37410. return factory(w);
  37411. };
  37412. } else {
  37413. factory(global);
  37414. }
  37415. // Pass this if window is not defined yet
  37416. })(typeof window !== "undefined" ? window : undefined, function (window, noGlobal) {
  37417. // Edge <= 12 - 13+, Firefox <=18 - 45+, IE 10 - 11, Safari 5.1 - 9+, iOS 6 - 9.1
  37418. // throw exceptions when non-strict code (e.g., ASP.NET 4.5) accesses strict mode
  37419. // arguments.callee.caller (trac-13335). But as of jQuery 3.0 (2016), strict mode should be common
  37420. // enough that all such attempts are guarded in a try block.
  37421. "use strict";
  37422. var arr = [];
  37423. var document = window.document;
  37424. var getProto = Object.getPrototypeOf;
  37425. var _slice = arr.slice;
  37426. var concat = arr.concat;
  37427. var push = arr.push;
  37428. var indexOf = arr.indexOf;
  37429. var class2type = {};
  37430. var toString = class2type.toString;
  37431. var hasOwn = class2type.hasOwnProperty;
  37432. var fnToString = hasOwn.toString;
  37433. var ObjectFunctionString = fnToString.call(Object);
  37434. var support = {};
  37435. var isFunction = function isFunction(obj) {
  37436. // Support: Chrome <=57, Firefox <=52
  37437. // In some browsers, typeof returns "function" for HTML <object> elements
  37438. // (i.e., `typeof document.createElement( "object" ) === "function"`).
  37439. // We don't want to classify *any* DOM node as a function.
  37440. return typeof obj === "function" && typeof obj.nodeType !== "number";
  37441. };
  37442. var isWindow = function isWindow(obj) {
  37443. return obj != null && obj === obj.window;
  37444. };
  37445. var preservedScriptAttributes = {
  37446. type: true,
  37447. src: true,
  37448. noModule: true
  37449. };
  37450. function DOMEval(code, doc, node) {
  37451. doc = doc || document;
  37452. var i,
  37453. script = doc.createElement("script");
  37454. script.text = code;
  37455. if (node) {
  37456. for (i in preservedScriptAttributes) {
  37457. if (node[i]) {
  37458. script[i] = node[i];
  37459. }
  37460. }
  37461. }
  37462. doc.head.appendChild(script).parentNode.removeChild(script);
  37463. }
  37464. function toType(obj) {
  37465. if (obj == null) {
  37466. return obj + "";
  37467. }
  37468. // Support: Android <=2.3 only (functionish RegExp)
  37469. return (typeof obj === "undefined" ? "undefined" : _typeof(obj)) === "object" || typeof obj === "function" ? class2type[toString.call(obj)] || "object" : typeof obj === "undefined" ? "undefined" : _typeof(obj);
  37470. }
  37471. /* global Symbol */
  37472. // Defining this global in .eslintrc.json would create a danger of using the global
  37473. // unguarded in another place, it seems safer to define global only for this module
  37474. var version = "3.3.1",
  37475. // Define a local copy of jQuery
  37476. jQuery = function jQuery(selector, context) {
  37477. // The jQuery object is actually just the init constructor 'enhanced'
  37478. // Need init if jQuery is called (just allow error to be thrown if not included)
  37479. return new jQuery.fn.init(selector, context);
  37480. },
  37481. // Support: Android <=4.0 only
  37482. // Make sure we trim BOM and NBSP
  37483. rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g;
  37484. jQuery.fn = jQuery.prototype = {
  37485. // The current version of jQuery being used
  37486. jquery: version,
  37487. constructor: jQuery,
  37488. // The default length of a jQuery object is 0
  37489. length: 0,
  37490. toArray: function toArray() {
  37491. return _slice.call(this);
  37492. },
  37493. // Get the Nth element in the matched element set OR
  37494. // Get the whole matched element set as a clean array
  37495. get: function get(num) {
  37496. // Return all the elements in a clean array
  37497. if (num == null) {
  37498. return _slice.call(this);
  37499. }
  37500. // Return just the one element from the set
  37501. return num < 0 ? this[num + this.length] : this[num];
  37502. },
  37503. // Take an array of elements and push it onto the stack
  37504. // (returning the new matched element set)
  37505. pushStack: function pushStack(elems) {
  37506. // Build a new jQuery matched element set
  37507. var ret = jQuery.merge(this.constructor(), elems);
  37508. // Add the old object onto the stack (as a reference)
  37509. ret.prevObject = this;
  37510. // Return the newly-formed element set
  37511. return ret;
  37512. },
  37513. // Execute a callback for every element in the matched set.
  37514. each: function each(callback) {
  37515. return jQuery.each(this, callback);
  37516. },
  37517. map: function map(callback) {
  37518. return this.pushStack(jQuery.map(this, function (elem, i) {
  37519. return callback.call(elem, i, elem);
  37520. }));
  37521. },
  37522. slice: function slice() {
  37523. return this.pushStack(_slice.apply(this, arguments));
  37524. },
  37525. first: function first() {
  37526. return this.eq(0);
  37527. },
  37528. last: function last() {
  37529. return this.eq(-1);
  37530. },
  37531. eq: function eq(i) {
  37532. var len = this.length,
  37533. j = +i + (i < 0 ? len : 0);
  37534. return this.pushStack(j >= 0 && j < len ? [this[j]] : []);
  37535. },
  37536. end: function end() {
  37537. return this.prevObject || this.constructor();
  37538. },
  37539. // For internal use only.
  37540. // Behaves like an Array's method, not like a jQuery method.
  37541. push: push,
  37542. sort: arr.sort,
  37543. splice: arr.splice
  37544. };
  37545. jQuery.extend = jQuery.fn.extend = function () {
  37546. var options,
  37547. name,
  37548. src,
  37549. copy,
  37550. copyIsArray,
  37551. clone,
  37552. target = arguments[0] || {},
  37553. i = 1,
  37554. length = arguments.length,
  37555. deep = false;
  37556. // Handle a deep copy situation
  37557. if (typeof target === "boolean") {
  37558. deep = target;
  37559. // Skip the boolean and the target
  37560. target = arguments[i] || {};
  37561. i++;
  37562. }
  37563. // Handle case when target is a string or something (possible in deep copy)
  37564. if ((typeof target === "undefined" ? "undefined" : _typeof(target)) !== "object" && !isFunction(target)) {
  37565. target = {};
  37566. }
  37567. // Extend jQuery itself if only one argument is passed
  37568. if (i === length) {
  37569. target = this;
  37570. i--;
  37571. }
  37572. for (; i < length; i++) {
  37573. // Only deal with non-null/undefined values
  37574. if ((options = arguments[i]) != null) {
  37575. // Extend the base object
  37576. for (name in options) {
  37577. src = target[name];
  37578. copy = options[name];
  37579. // Prevent never-ending loop
  37580. if (target === copy) {
  37581. continue;
  37582. }
  37583. // Recurse if we're merging plain objects or arrays
  37584. if (deep && copy && (jQuery.isPlainObject(copy) || (copyIsArray = Array.isArray(copy)))) {
  37585. if (copyIsArray) {
  37586. copyIsArray = false;
  37587. clone = src && Array.isArray(src) ? src : [];
  37588. } else {
  37589. clone = src && jQuery.isPlainObject(src) ? src : {};
  37590. }
  37591. // Never move original objects, clone them
  37592. target[name] = jQuery.extend(deep, clone, copy);
  37593. // Don't bring in undefined values
  37594. } else if (copy !== undefined) {
  37595. target[name] = copy;
  37596. }
  37597. }
  37598. }
  37599. }
  37600. // Return the modified object
  37601. return target;
  37602. };
  37603. jQuery.extend({
  37604. // Unique for each copy of jQuery on the page
  37605. expando: "jQuery" + (version + Math.random()).replace(/\D/g, ""),
  37606. // Assume jQuery is ready without the ready module
  37607. isReady: true,
  37608. error: function error(msg) {
  37609. throw new Error(msg);
  37610. },
  37611. noop: function noop() {},
  37612. isPlainObject: function isPlainObject(obj) {
  37613. var proto, Ctor;
  37614. // Detect obvious negatives
  37615. // Use toString instead of jQuery.type to catch host objects
  37616. if (!obj || toString.call(obj) !== "[object Object]") {
  37617. return false;
  37618. }
  37619. proto = getProto(obj);
  37620. // Objects with no prototype (e.g., `Object.create( null )`) are plain
  37621. if (!proto) {
  37622. return true;
  37623. }
  37624. // Objects with prototype are plain iff they were constructed by a global Object function
  37625. Ctor = hasOwn.call(proto, "constructor") && proto.constructor;
  37626. return typeof Ctor === "function" && fnToString.call(Ctor) === ObjectFunctionString;
  37627. },
  37628. isEmptyObject: function isEmptyObject(obj) {
  37629. /* eslint-disable no-unused-vars */
  37630. // See https://github.com/eslint/eslint/issues/6125
  37631. var name;
  37632. for (name in obj) {
  37633. return false;
  37634. }
  37635. return true;
  37636. },
  37637. // Evaluates a script in a global context
  37638. globalEval: function globalEval(code) {
  37639. DOMEval(code);
  37640. },
  37641. each: function each(obj, callback) {
  37642. var length,
  37643. i = 0;
  37644. if (isArrayLike(obj)) {
  37645. length = obj.length;
  37646. for (; i < length; i++) {
  37647. if (callback.call(obj[i], i, obj[i]) === false) {
  37648. break;
  37649. }
  37650. }
  37651. } else {
  37652. for (i in obj) {
  37653. if (callback.call(obj[i], i, obj[i]) === false) {
  37654. break;
  37655. }
  37656. }
  37657. }
  37658. return obj;
  37659. },
  37660. // Support: Android <=4.0 only
  37661. trim: function trim(text) {
  37662. return text == null ? "" : (text + "").replace(rtrim, "");
  37663. },
  37664. // results is for internal usage only
  37665. makeArray: function makeArray(arr, results) {
  37666. var ret = results || [];
  37667. if (arr != null) {
  37668. if (isArrayLike(Object(arr))) {
  37669. jQuery.merge(ret, typeof arr === "string" ? [arr] : arr);
  37670. } else {
  37671. push.call(ret, arr);
  37672. }
  37673. }
  37674. return ret;
  37675. },
  37676. inArray: function inArray(elem, arr, i) {
  37677. return arr == null ? -1 : indexOf.call(arr, elem, i);
  37678. },
  37679. // Support: Android <=4.0 only, PhantomJS 1 only
  37680. // push.apply(_, arraylike) throws on ancient WebKit
  37681. merge: function merge(first, second) {
  37682. var len = +second.length,
  37683. j = 0,
  37684. i = first.length;
  37685. for (; j < len; j++) {
  37686. first[i++] = second[j];
  37687. }
  37688. first.length = i;
  37689. return first;
  37690. },
  37691. grep: function grep(elems, callback, invert) {
  37692. var callbackInverse,
  37693. matches = [],
  37694. i = 0,
  37695. length = elems.length,
  37696. callbackExpect = !invert;
  37697. // Go through the array, only saving the items
  37698. // that pass the validator function
  37699. for (; i < length; i++) {
  37700. callbackInverse = !callback(elems[i], i);
  37701. if (callbackInverse !== callbackExpect) {
  37702. matches.push(elems[i]);
  37703. }
  37704. }
  37705. return matches;
  37706. },
  37707. // arg is for internal usage only
  37708. map: function map(elems, callback, arg) {
  37709. var length,
  37710. value,
  37711. i = 0,
  37712. ret = [];
  37713. // Go through the array, translating each of the items to their new values
  37714. if (isArrayLike(elems)) {
  37715. length = elems.length;
  37716. for (; i < length; i++) {
  37717. value = callback(elems[i], i, arg);
  37718. if (value != null) {
  37719. ret.push(value);
  37720. }
  37721. }
  37722. // Go through every key on the object,
  37723. } else {
  37724. for (i in elems) {
  37725. value = callback(elems[i], i, arg);
  37726. if (value != null) {
  37727. ret.push(value);
  37728. }
  37729. }
  37730. }
  37731. // Flatten any nested arrays
  37732. return concat.apply([], ret);
  37733. },
  37734. // A global GUID counter for objects
  37735. guid: 1,
  37736. // jQuery.support is not used in Core but other projects attach their
  37737. // properties to it so it needs to exist.
  37738. support: support
  37739. });
  37740. if (typeof Symbol === "function") {
  37741. jQuery.fn[Symbol.iterator] = arr[Symbol.iterator];
  37742. }
  37743. // Populate the class2type map
  37744. jQuery.each("Boolean Number String Function Array Date RegExp Object Error Symbol".split(" "), function (i, name) {
  37745. class2type["[object " + name + "]"] = name.toLowerCase();
  37746. });
  37747. function isArrayLike(obj) {
  37748. // Support: real iOS 8.2 only (not reproducible in simulator)
  37749. // `in` check used to prevent JIT error (gh-2145)
  37750. // hasOwn isn't used here due to false negatives
  37751. // regarding Nodelist length in IE
  37752. var length = !!obj && "length" in obj && obj.length,
  37753. type = toType(obj);
  37754. if (isFunction(obj) || isWindow(obj)) {
  37755. return false;
  37756. }
  37757. return type === "array" || length === 0 || typeof length === "number" && length > 0 && length - 1 in obj;
  37758. }
  37759. var Sizzle =
  37760. /*!
  37761. * Sizzle CSS Selector Engine v2.3.3
  37762. * https://sizzlejs.com/
  37763. *
  37764. * Copyright jQuery Foundation and other contributors
  37765. * Released under the MIT license
  37766. * http://jquery.org/license
  37767. *
  37768. * Date: 2016-08-08
  37769. */
  37770. function (window) {
  37771. var i,
  37772. support,
  37773. Expr,
  37774. getText,
  37775. isXML,
  37776. tokenize,
  37777. compile,
  37778. select,
  37779. outermostContext,
  37780. sortInput,
  37781. hasDuplicate,
  37782. // Local document vars
  37783. setDocument,
  37784. document,
  37785. docElem,
  37786. documentIsHTML,
  37787. rbuggyQSA,
  37788. rbuggyMatches,
  37789. matches,
  37790. contains,
  37791. // Instance-specific data
  37792. expando = "sizzle" + 1 * new Date(),
  37793. preferredDoc = window.document,
  37794. dirruns = 0,
  37795. done = 0,
  37796. classCache = createCache(),
  37797. tokenCache = createCache(),
  37798. compilerCache = createCache(),
  37799. sortOrder = function sortOrder(a, b) {
  37800. if (a === b) {
  37801. hasDuplicate = true;
  37802. }
  37803. return 0;
  37804. },
  37805. // Instance methods
  37806. hasOwn = {}.hasOwnProperty,
  37807. arr = [],
  37808. pop = arr.pop,
  37809. push_native = arr.push,
  37810. push = arr.push,
  37811. slice = arr.slice,
  37812. // Use a stripped-down indexOf as it's faster than native
  37813. // https://jsperf.com/thor-indexof-vs-for/5
  37814. indexOf = function indexOf(list, elem) {
  37815. var i = 0,
  37816. len = list.length;
  37817. for (; i < len; i++) {
  37818. if (list[i] === elem) {
  37819. return i;
  37820. }
  37821. }
  37822. return -1;
  37823. },
  37824. booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",
  37825. // Regular expressions
  37826. // http://www.w3.org/TR/css3-selectors/#whitespace
  37827. whitespace = "[\\x20\\t\\r\\n\\f]",
  37828. // http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier
  37829. identifier = "(?:\\\\.|[\\w-]|[^\0-\\xa0])+",
  37830. // Attribute selectors: http://www.w3.org/TR/selectors/#attribute-selectors
  37831. attributes = "\\[" + whitespace + "*(" + identifier + ")(?:" + whitespace +
  37832. // Operator (capture 2)
  37833. "*([*^$|!~]?=)" + whitespace +
  37834. // "Attribute values must be CSS identifiers [capture 5] or strings [capture 3 or capture 4]"
  37835. "*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|(" + identifier + "))|)" + whitespace + "*\\]",
  37836. pseudos = ":(" + identifier + ")(?:\\((" +
  37837. // To reduce the number of selectors needing tokenize in the preFilter, prefer arguments:
  37838. // 1. quoted (capture 3; capture 4 or capture 5)
  37839. "('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|" +
  37840. // 2. simple (capture 6)
  37841. "((?:\\\\.|[^\\\\()[\\]]|" + attributes + ")*)|" +
  37842. // 3. anything else (capture 2)
  37843. ".*" + ")\\)|)",
  37844. // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter
  37845. rwhitespace = new RegExp(whitespace + "+", "g"),
  37846. rtrim = new RegExp("^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g"),
  37847. rcomma = new RegExp("^" + whitespace + "*," + whitespace + "*"),
  37848. rcombinators = new RegExp("^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace + "*"),
  37849. rattributeQuotes = new RegExp("=" + whitespace + "*([^\\]'\"]*?)" + whitespace + "*\\]", "g"),
  37850. rpseudo = new RegExp(pseudos),
  37851. ridentifier = new RegExp("^" + identifier + "$"),
  37852. matchExpr = {
  37853. "ID": new RegExp("^#(" + identifier + ")"),
  37854. "CLASS": new RegExp("^\\.(" + identifier + ")"),
  37855. "TAG": new RegExp("^(" + identifier + "|[*])"),
  37856. "ATTR": new RegExp("^" + attributes),
  37857. "PSEUDO": new RegExp("^" + pseudos),
  37858. "CHILD": new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + whitespace + "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace + "*(\\d+)|))" + whitespace + "*\\)|)", "i"),
  37859. "bool": new RegExp("^(?:" + booleans + ")$", "i"),
  37860. // For use in libraries implementing .is()
  37861. // We use this for POS matching in `select`
  37862. "needsContext": new RegExp("^" + whitespace + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" + whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i")
  37863. },
  37864. rinputs = /^(?:input|select|textarea|button)$/i,
  37865. rheader = /^h\d$/i,
  37866. rnative = /^[^{]+\{\s*\[native \w/,
  37867. // Easily-parseable/retrievable ID or TAG or CLASS selectors
  37868. rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,
  37869. rsibling = /[+~]/,
  37870. // CSS escapes
  37871. // http://www.w3.org/TR/CSS21/syndata.html#escaped-characters
  37872. runescape = new RegExp("\\\\([\\da-f]{1,6}" + whitespace + "?|(" + whitespace + ")|.)", "ig"),
  37873. funescape = function funescape(_, escaped, escapedWhitespace) {
  37874. var high = "0x" + escaped - 0x10000;
  37875. // NaN means non-codepoint
  37876. // Support: Firefox<24
  37877. // Workaround erroneous numeric interpretation of +"0x"
  37878. return high !== high || escapedWhitespace ? escaped : high < 0 ?
  37879. // BMP codepoint
  37880. String.fromCharCode(high + 0x10000) :
  37881. // Supplemental Plane codepoint (surrogate pair)
  37882. String.fromCharCode(high >> 10 | 0xD800, high & 0x3FF | 0xDC00);
  37883. },
  37884. // CSS string/identifier serialization
  37885. // https://drafts.csswg.org/cssom/#common-serializing-idioms
  37886. rcssescape = /([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g,
  37887. fcssescape = function fcssescape(ch, asCodePoint) {
  37888. if (asCodePoint) {
  37889. // U+0000 NULL becomes U+FFFD REPLACEMENT CHARACTER
  37890. if (ch === "\0") {
  37891. return "\uFFFD";
  37892. }
  37893. // Control characters and (dependent upon position) numbers get escaped as code points
  37894. return ch.slice(0, -1) + "\\" + ch.charCodeAt(ch.length - 1).toString(16) + " ";
  37895. }
  37896. // Other potentially-special ASCII characters get backslash-escaped
  37897. return "\\" + ch;
  37898. },
  37899. // Used for iframes
  37900. // See setDocument()
  37901. // Removing the function wrapper causes a "Permission Denied"
  37902. // error in IE
  37903. unloadHandler = function unloadHandler() {
  37904. setDocument();
  37905. },
  37906. disabledAncestor = addCombinator(function (elem) {
  37907. return elem.disabled === true && ("form" in elem || "label" in elem);
  37908. }, { dir: "parentNode", next: "legend" });
  37909. // Optimize for push.apply( _, NodeList )
  37910. try {
  37911. push.apply(arr = slice.call(preferredDoc.childNodes), preferredDoc.childNodes);
  37912. // Support: Android<4.0
  37913. // Detect silently failing push.apply
  37914. arr[preferredDoc.childNodes.length].nodeType;
  37915. } catch (e) {
  37916. push = { apply: arr.length ?
  37917. // Leverage slice if possible
  37918. function (target, els) {
  37919. push_native.apply(target, slice.call(els));
  37920. } :
  37921. // Support: IE<9
  37922. // Otherwise append directly
  37923. function (target, els) {
  37924. var j = target.length,
  37925. i = 0;
  37926. // Can't trust NodeList.length
  37927. while (target[j++] = els[i++]) {}
  37928. target.length = j - 1;
  37929. }
  37930. };
  37931. }
  37932. function Sizzle(selector, context, results, seed) {
  37933. var m,
  37934. i,
  37935. elem,
  37936. nid,
  37937. match,
  37938. groups,
  37939. newSelector,
  37940. newContext = context && context.ownerDocument,
  37941. // nodeType defaults to 9, since context defaults to document
  37942. nodeType = context ? context.nodeType : 9;
  37943. results = results || [];
  37944. // Return early from calls with invalid selector or context
  37945. if (typeof selector !== "string" || !selector || nodeType !== 1 && nodeType !== 9 && nodeType !== 11) {
  37946. return results;
  37947. }
  37948. // Try to shortcut find operations (as opposed to filters) in HTML documents
  37949. if (!seed) {
  37950. if ((context ? context.ownerDocument || context : preferredDoc) !== document) {
  37951. setDocument(context);
  37952. }
  37953. context = context || document;
  37954. if (documentIsHTML) {
  37955. // If the selector is sufficiently simple, try using a "get*By*" DOM method
  37956. // (excepting DocumentFragment context, where the methods don't exist)
  37957. if (nodeType !== 11 && (match = rquickExpr.exec(selector))) {
  37958. // ID selector
  37959. if (m = match[1]) {
  37960. // Document context
  37961. if (nodeType === 9) {
  37962. if (elem = context.getElementById(m)) {
  37963. // Support: IE, Opera, Webkit
  37964. // TODO: identify versions
  37965. // getElementById can match elements by name instead of ID
  37966. if (elem.id === m) {
  37967. results.push(elem);
  37968. return results;
  37969. }
  37970. } else {
  37971. return results;
  37972. }
  37973. // Element context
  37974. } else {
  37975. // Support: IE, Opera, Webkit
  37976. // TODO: identify versions
  37977. // getElementById can match elements by name instead of ID
  37978. if (newContext && (elem = newContext.getElementById(m)) && contains(context, elem) && elem.id === m) {
  37979. results.push(elem);
  37980. return results;
  37981. }
  37982. }
  37983. // Type selector
  37984. } else if (match[2]) {
  37985. push.apply(results, context.getElementsByTagName(selector));
  37986. return results;
  37987. // Class selector
  37988. } else if ((m = match[3]) && support.getElementsByClassName && context.getElementsByClassName) {
  37989. push.apply(results, context.getElementsByClassName(m));
  37990. return results;
  37991. }
  37992. }
  37993. // Take advantage of querySelectorAll
  37994. if (support.qsa && !compilerCache[selector + " "] && (!rbuggyQSA || !rbuggyQSA.test(selector))) {
  37995. if (nodeType !== 1) {
  37996. newContext = context;
  37997. newSelector = selector;
  37998. // qSA looks outside Element context, which is not what we want
  37999. // Thanks to Andrew Dupont for this workaround technique
  38000. // Support: IE <=8
  38001. // Exclude object elements
  38002. } else if (context.nodeName.toLowerCase() !== "object") {
  38003. // Capture the context ID, setting it first if necessary
  38004. if (nid = context.getAttribute("id")) {
  38005. nid = nid.replace(rcssescape, fcssescape);
  38006. } else {
  38007. context.setAttribute("id", nid = expando);
  38008. }
  38009. // Prefix every selector in the list
  38010. groups = tokenize(selector);
  38011. i = groups.length;
  38012. while (i--) {
  38013. groups[i] = "#" + nid + " " + toSelector(groups[i]);
  38014. }
  38015. newSelector = groups.join(",");
  38016. // Expand context for sibling selectors
  38017. newContext = rsibling.test(selector) && testContext(context.parentNode) || context;
  38018. }
  38019. if (newSelector) {
  38020. try {
  38021. push.apply(results, newContext.querySelectorAll(newSelector));
  38022. return results;
  38023. } catch (qsaError) {} finally {
  38024. if (nid === expando) {
  38025. context.removeAttribute("id");
  38026. }
  38027. }
  38028. }
  38029. }
  38030. }
  38031. }
  38032. // All others
  38033. return select(selector.replace(rtrim, "$1"), context, results, seed);
  38034. }
  38035. /**
  38036. * Create key-value caches of limited size
  38037. * @returns {function(string, object)} Returns the Object data after storing it on itself with
  38038. * property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength)
  38039. * deleting the oldest entry
  38040. */
  38041. function createCache() {
  38042. var keys = [];
  38043. function cache(key, value) {
  38044. // Use (key + " ") to avoid collision with native prototype properties (see Issue #157)
  38045. if (keys.push(key + " ") > Expr.cacheLength) {
  38046. // Only keep the most recent entries
  38047. delete cache[keys.shift()];
  38048. }
  38049. return cache[key + " "] = value;
  38050. }
  38051. return cache;
  38052. }
  38053. /**
  38054. * Mark a function for special use by Sizzle
  38055. * @param {Function} fn The function to mark
  38056. */
  38057. function markFunction(fn) {
  38058. fn[expando] = true;
  38059. return fn;
  38060. }
  38061. /**
  38062. * Support testing using an element
  38063. * @param {Function} fn Passed the created element and returns a boolean result
  38064. */
  38065. function assert(fn) {
  38066. var el = document.createElement("fieldset");
  38067. try {
  38068. return !!fn(el);
  38069. } catch (e) {
  38070. return false;
  38071. } finally {
  38072. // Remove from its parent by default
  38073. if (el.parentNode) {
  38074. el.parentNode.removeChild(el);
  38075. }
  38076. // release memory in IE
  38077. el = null;
  38078. }
  38079. }
  38080. /**
  38081. * Adds the same handler for all of the specified attrs
  38082. * @param {String} attrs Pipe-separated list of attributes
  38083. * @param {Function} handler The method that will be applied
  38084. */
  38085. function addHandle(attrs, handler) {
  38086. var arr = attrs.split("|"),
  38087. i = arr.length;
  38088. while (i--) {
  38089. Expr.attrHandle[arr[i]] = handler;
  38090. }
  38091. }
  38092. /**
  38093. * Checks document order of two siblings
  38094. * @param {Element} a
  38095. * @param {Element} b
  38096. * @returns {Number} Returns less than 0 if a precedes b, greater than 0 if a follows b
  38097. */
  38098. function siblingCheck(a, b) {
  38099. var cur = b && a,
  38100. diff = cur && a.nodeType === 1 && b.nodeType === 1 && a.sourceIndex - b.sourceIndex;
  38101. // Use IE sourceIndex if available on both nodes
  38102. if (diff) {
  38103. return diff;
  38104. }
  38105. // Check if b follows a
  38106. if (cur) {
  38107. while (cur = cur.nextSibling) {
  38108. if (cur === b) {
  38109. return -1;
  38110. }
  38111. }
  38112. }
  38113. return a ? 1 : -1;
  38114. }
  38115. /**
  38116. * Returns a function to use in pseudos for input types
  38117. * @param {String} type
  38118. */
  38119. function createInputPseudo(type) {
  38120. return function (elem) {
  38121. var name = elem.nodeName.toLowerCase();
  38122. return name === "input" && elem.type === type;
  38123. };
  38124. }
  38125. /**
  38126. * Returns a function to use in pseudos for buttons
  38127. * @param {String} type
  38128. */
  38129. function createButtonPseudo(type) {
  38130. return function (elem) {
  38131. var name = elem.nodeName.toLowerCase();
  38132. return (name === "input" || name === "button") && elem.type === type;
  38133. };
  38134. }
  38135. /**
  38136. * Returns a function to use in pseudos for :enabled/:disabled
  38137. * @param {Boolean} disabled true for :disabled; false for :enabled
  38138. */
  38139. function createDisabledPseudo(disabled) {
  38140. // Known :disabled false positives: fieldset[disabled] > legend:nth-of-type(n+2) :can-disable
  38141. return function (elem) {
  38142. // Only certain elements can match :enabled or :disabled
  38143. // https://html.spec.whatwg.org/multipage/scripting.html#selector-enabled
  38144. // https://html.spec.whatwg.org/multipage/scripting.html#selector-disabled
  38145. if ("form" in elem) {
  38146. // Check for inherited disabledness on relevant non-disabled elements:
  38147. // * listed form-associated elements in a disabled fieldset
  38148. // https://html.spec.whatwg.org/multipage/forms.html#category-listed
  38149. // https://html.spec.whatwg.org/multipage/forms.html#concept-fe-disabled
  38150. // * option elements in a disabled optgroup
  38151. // https://html.spec.whatwg.org/multipage/forms.html#concept-option-disabled
  38152. // All such elements have a "form" property.
  38153. if (elem.parentNode && elem.disabled === false) {
  38154. // Option elements defer to a parent optgroup if present
  38155. if ("label" in elem) {
  38156. if ("label" in elem.parentNode) {
  38157. return elem.parentNode.disabled === disabled;
  38158. } else {
  38159. return elem.disabled === disabled;
  38160. }
  38161. }
  38162. // Support: IE 6 - 11
  38163. // Use the isDisabled shortcut property to check for disabled fieldset ancestors
  38164. return elem.isDisabled === disabled ||
  38165. // Where there is no isDisabled, check manually
  38166. /* jshint -W018 */
  38167. elem.isDisabled !== !disabled && disabledAncestor(elem) === disabled;
  38168. }
  38169. return elem.disabled === disabled;
  38170. // Try to winnow out elements that can't be disabled before trusting the disabled property.
  38171. // Some victims get caught in our net (label, legend, menu, track), but it shouldn't
  38172. // even exist on them, let alone have a boolean value.
  38173. } else if ("label" in elem) {
  38174. return elem.disabled === disabled;
  38175. }
  38176. // Remaining elements are neither :enabled nor :disabled
  38177. return false;
  38178. };
  38179. }
  38180. /**
  38181. * Returns a function to use in pseudos for positionals
  38182. * @param {Function} fn
  38183. */
  38184. function createPositionalPseudo(fn) {
  38185. return markFunction(function (argument) {
  38186. argument = +argument;
  38187. return markFunction(function (seed, matches) {
  38188. var j,
  38189. matchIndexes = fn([], seed.length, argument),
  38190. i = matchIndexes.length;
  38191. // Match elements found at the specified indexes
  38192. while (i--) {
  38193. if (seed[j = matchIndexes[i]]) {
  38194. seed[j] = !(matches[j] = seed[j]);
  38195. }
  38196. }
  38197. });
  38198. });
  38199. }
  38200. /**
  38201. * Checks a node for validity as a Sizzle context
  38202. * @param {Element|Object=} context
  38203. * @returns {Element|Object|Boolean} The input node if acceptable, otherwise a falsy value
  38204. */
  38205. function testContext(context) {
  38206. return context && typeof context.getElementsByTagName !== "undefined" && context;
  38207. }
  38208. // Expose support vars for convenience
  38209. support = Sizzle.support = {};
  38210. /**
  38211. * Detects XML nodes
  38212. * @param {Element|Object} elem An element or a document
  38213. * @returns {Boolean} True iff elem is a non-HTML XML node
  38214. */
  38215. isXML = Sizzle.isXML = function (elem) {
  38216. // documentElement is verified for cases where it doesn't yet exist
  38217. // (such as loading iframes in IE - #4833)
  38218. var documentElement = elem && (elem.ownerDocument || elem).documentElement;
  38219. return documentElement ? documentElement.nodeName !== "HTML" : false;
  38220. };
  38221. /**
  38222. * Sets document-related variables once based on the current document
  38223. * @param {Element|Object} [doc] An element or document object to use to set the document
  38224. * @returns {Object} Returns the current document
  38225. */
  38226. setDocument = Sizzle.setDocument = function (node) {
  38227. var hasCompare,
  38228. subWindow,
  38229. doc = node ? node.ownerDocument || node : preferredDoc;
  38230. // Return early if doc is invalid or already selected
  38231. if (doc === document || doc.nodeType !== 9 || !doc.documentElement) {
  38232. return document;
  38233. }
  38234. // Update global variables
  38235. document = doc;
  38236. docElem = document.documentElement;
  38237. documentIsHTML = !isXML(document);
  38238. // Support: IE 9-11, Edge
  38239. // Accessing iframe documents after unload throws "permission denied" errors (jQuery #13936)
  38240. if (preferredDoc !== document && (subWindow = document.defaultView) && subWindow.top !== subWindow) {
  38241. // Support: IE 11, Edge
  38242. if (subWindow.addEventListener) {
  38243. subWindow.addEventListener("unload", unloadHandler, false);
  38244. // Support: IE 9 - 10 only
  38245. } else if (subWindow.attachEvent) {
  38246. subWindow.attachEvent("onunload", unloadHandler);
  38247. }
  38248. }
  38249. /* Attributes
  38250. ---------------------------------------------------------------------- */
  38251. // Support: IE<8
  38252. // Verify that getAttribute really returns attributes and not properties
  38253. // (excepting IE8 booleans)
  38254. support.attributes = assert(function (el) {
  38255. el.className = "i";
  38256. return !el.getAttribute("className");
  38257. });
  38258. /* getElement(s)By*
  38259. ---------------------------------------------------------------------- */
  38260. // Check if getElementsByTagName("*") returns only elements
  38261. support.getElementsByTagName = assert(function (el) {
  38262. el.appendChild(document.createComment(""));
  38263. return !el.getElementsByTagName("*").length;
  38264. });
  38265. // Support: IE<9
  38266. support.getElementsByClassName = rnative.test(document.getElementsByClassName);
  38267. // Support: IE<10
  38268. // Check if getElementById returns elements by name
  38269. // The broken getElementById methods don't pick up programmatically-set names,
  38270. // so use a roundabout getElementsByName test
  38271. support.getById = assert(function (el) {
  38272. docElem.appendChild(el).id = expando;
  38273. return !document.getElementsByName || !document.getElementsByName(expando).length;
  38274. });
  38275. // ID filter and find
  38276. if (support.getById) {
  38277. Expr.filter["ID"] = function (id) {
  38278. var attrId = id.replace(runescape, funescape);
  38279. return function (elem) {
  38280. return elem.getAttribute("id") === attrId;
  38281. };
  38282. };
  38283. Expr.find["ID"] = function (id, context) {
  38284. if (typeof context.getElementById !== "undefined" && documentIsHTML) {
  38285. var elem = context.getElementById(id);
  38286. return elem ? [elem] : [];
  38287. }
  38288. };
  38289. } else {
  38290. Expr.filter["ID"] = function (id) {
  38291. var attrId = id.replace(runescape, funescape);
  38292. return function (elem) {
  38293. var node = typeof elem.getAttributeNode !== "undefined" && elem.getAttributeNode("id");
  38294. return node && node.value === attrId;
  38295. };
  38296. };
  38297. // Support: IE 6 - 7 only
  38298. // getElementById is not reliable as a find shortcut
  38299. Expr.find["ID"] = function (id, context) {
  38300. if (typeof context.getElementById !== "undefined" && documentIsHTML) {
  38301. var node,
  38302. i,
  38303. elems,
  38304. elem = context.getElementById(id);
  38305. if (elem) {
  38306. // Verify the id attribute
  38307. node = elem.getAttributeNode("id");
  38308. if (node && node.value === id) {
  38309. return [elem];
  38310. }
  38311. // Fall back on getElementsByName
  38312. elems = context.getElementsByName(id);
  38313. i = 0;
  38314. while (elem = elems[i++]) {
  38315. node = elem.getAttributeNode("id");
  38316. if (node && node.value === id) {
  38317. return [elem];
  38318. }
  38319. }
  38320. }
  38321. return [];
  38322. }
  38323. };
  38324. }
  38325. // Tag
  38326. Expr.find["TAG"] = support.getElementsByTagName ? function (tag, context) {
  38327. if (typeof context.getElementsByTagName !== "undefined") {
  38328. return context.getElementsByTagName(tag);
  38329. // DocumentFragment nodes don't have gEBTN
  38330. } else if (support.qsa) {
  38331. return context.querySelectorAll(tag);
  38332. }
  38333. } : function (tag, context) {
  38334. var elem,
  38335. tmp = [],
  38336. i = 0,
  38337. // By happy coincidence, a (broken) gEBTN appears on DocumentFragment nodes too
  38338. results = context.getElementsByTagName(tag);
  38339. // Filter out possible comments
  38340. if (tag === "*") {
  38341. while (elem = results[i++]) {
  38342. if (elem.nodeType === 1) {
  38343. tmp.push(elem);
  38344. }
  38345. }
  38346. return tmp;
  38347. }
  38348. return results;
  38349. };
  38350. // Class
  38351. Expr.find["CLASS"] = support.getElementsByClassName && function (className, context) {
  38352. if (typeof context.getElementsByClassName !== "undefined" && documentIsHTML) {
  38353. return context.getElementsByClassName(className);
  38354. }
  38355. };
  38356. /* QSA/matchesSelector
  38357. ---------------------------------------------------------------------- */
  38358. // QSA and matchesSelector support
  38359. // matchesSelector(:active) reports false when true (IE9/Opera 11.5)
  38360. rbuggyMatches = [];
  38361. // qSa(:focus) reports false when true (Chrome 21)
  38362. // We allow this because of a bug in IE8/9 that throws an error
  38363. // whenever `document.activeElement` is accessed on an iframe
  38364. // So, we allow :focus to pass through QSA all the time to avoid the IE error
  38365. // See https://bugs.jquery.com/ticket/13378
  38366. rbuggyQSA = [];
  38367. if (support.qsa = rnative.test(document.querySelectorAll)) {
  38368. // Build QSA regex
  38369. // Regex strategy adopted from Diego Perini
  38370. assert(function (el) {
  38371. // Select is set to empty string on purpose
  38372. // This is to test IE's treatment of not explicitly
  38373. // setting a boolean content attribute,
  38374. // since its presence should be enough
  38375. // https://bugs.jquery.com/ticket/12359
  38376. docElem.appendChild(el).innerHTML = "<a id='" + expando + "'></a>" + "<select id='" + expando + "-\r\\' msallowcapture=''>" + "<option selected=''></option></select>";
  38377. // Support: IE8, Opera 11-12.16
  38378. // Nothing should be selected when empty strings follow ^= or $= or *=
  38379. // The test attribute must be unknown in Opera but "safe" for WinRT
  38380. // https://msdn.microsoft.com/en-us/library/ie/hh465388.aspx#attribute_section
  38381. if (el.querySelectorAll("[msallowcapture^='']").length) {
  38382. rbuggyQSA.push("[*^$]=" + whitespace + "*(?:''|\"\")");
  38383. }
  38384. // Support: IE8
  38385. // Boolean attributes and "value" are not treated correctly
  38386. if (!el.querySelectorAll("[selected]").length) {
  38387. rbuggyQSA.push("\\[" + whitespace + "*(?:value|" + booleans + ")");
  38388. }
  38389. // Support: Chrome<29, Android<4.4, Safari<7.0+, iOS<7.0+, PhantomJS<1.9.8+
  38390. if (!el.querySelectorAll("[id~=" + expando + "-]").length) {
  38391. rbuggyQSA.push("~=");
  38392. }
  38393. // Webkit/Opera - :checked should return selected option elements
  38394. // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
  38395. // IE8 throws error here and will not see later tests
  38396. if (!el.querySelectorAll(":checked").length) {
  38397. rbuggyQSA.push(":checked");
  38398. }
  38399. // Support: Safari 8+, iOS 8+
  38400. // https://bugs.webkit.org/show_bug.cgi?id=136851
  38401. // In-page `selector#id sibling-combinator selector` fails
  38402. if (!el.querySelectorAll("a#" + expando + "+*").length) {
  38403. rbuggyQSA.push(".#.+[+~]");
  38404. }
  38405. });
  38406. assert(function (el) {
  38407. el.innerHTML = "<a href='' disabled='disabled'></a>" + "<select disabled='disabled'><option/></select>";
  38408. // Support: Windows 8 Native Apps
  38409. // The type and name attributes are restricted during .innerHTML assignment
  38410. var input = document.createElement("input");
  38411. input.setAttribute("type", "hidden");
  38412. el.appendChild(input).setAttribute("name", "D");
  38413. // Support: IE8
  38414. // Enforce case-sensitivity of name attribute
  38415. if (el.querySelectorAll("[name=d]").length) {
  38416. rbuggyQSA.push("name" + whitespace + "*[*^$|!~]?=");
  38417. }
  38418. // FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled)
  38419. // IE8 throws error here and will not see later tests
  38420. if (el.querySelectorAll(":enabled").length !== 2) {
  38421. rbuggyQSA.push(":enabled", ":disabled");
  38422. }
  38423. // Support: IE9-11+
  38424. // IE's :disabled selector does not pick up the children of disabled fieldsets
  38425. docElem.appendChild(el).disabled = true;
  38426. if (el.querySelectorAll(":disabled").length !== 2) {
  38427. rbuggyQSA.push(":enabled", ":disabled");
  38428. }
  38429. // Opera 10-11 does not throw on post-comma invalid pseudos
  38430. el.querySelectorAll("*,:x");
  38431. rbuggyQSA.push(",.*:");
  38432. });
  38433. }
  38434. if (support.matchesSelector = rnative.test(matches = docElem.matches || docElem.webkitMatchesSelector || docElem.mozMatchesSelector || docElem.oMatchesSelector || docElem.msMatchesSelector)) {
  38435. assert(function (el) {
  38436. // Check to see if it's possible to do matchesSelector
  38437. // on a disconnected node (IE 9)
  38438. support.disconnectedMatch = matches.call(el, "*");
  38439. // This should fail with an exception
  38440. // Gecko does not error, returns false instead
  38441. matches.call(el, "[s!='']:x");
  38442. rbuggyMatches.push("!=", pseudos);
  38443. });
  38444. }
  38445. rbuggyQSA = rbuggyQSA.length && new RegExp(rbuggyQSA.join("|"));
  38446. rbuggyMatches = rbuggyMatches.length && new RegExp(rbuggyMatches.join("|"));
  38447. /* Contains
  38448. ---------------------------------------------------------------------- */
  38449. hasCompare = rnative.test(docElem.compareDocumentPosition);
  38450. // Element contains another
  38451. // Purposefully self-exclusive
  38452. // As in, an element does not contain itself
  38453. contains = hasCompare || rnative.test(docElem.contains) ? function (a, b) {
  38454. var adown = a.nodeType === 9 ? a.documentElement : a,
  38455. bup = b && b.parentNode;
  38456. return a === bup || !!(bup && bup.nodeType === 1 && (adown.contains ? adown.contains(bup) : a.compareDocumentPosition && a.compareDocumentPosition(bup) & 16));
  38457. } : function (a, b) {
  38458. if (b) {
  38459. while (b = b.parentNode) {
  38460. if (b === a) {
  38461. return true;
  38462. }
  38463. }
  38464. }
  38465. return false;
  38466. };
  38467. /* Sorting
  38468. ---------------------------------------------------------------------- */
  38469. // Document order sorting
  38470. sortOrder = hasCompare ? function (a, b) {
  38471. // Flag for duplicate removal
  38472. if (a === b) {
  38473. hasDuplicate = true;
  38474. return 0;
  38475. }
  38476. // Sort on method existence if only one input has compareDocumentPosition
  38477. var compare = !a.compareDocumentPosition - !b.compareDocumentPosition;
  38478. if (compare) {
  38479. return compare;
  38480. }
  38481. // Calculate position if both inputs belong to the same document
  38482. compare = (a.ownerDocument || a) === (b.ownerDocument || b) ? a.compareDocumentPosition(b) :
  38483. // Otherwise we know they are disconnected
  38484. 1;
  38485. // Disconnected nodes
  38486. if (compare & 1 || !support.sortDetached && b.compareDocumentPosition(a) === compare) {
  38487. // Choose the first element that is related to our preferred document
  38488. if (a === document || a.ownerDocument === preferredDoc && contains(preferredDoc, a)) {
  38489. return -1;
  38490. }
  38491. if (b === document || b.ownerDocument === preferredDoc && contains(preferredDoc, b)) {
  38492. return 1;
  38493. }
  38494. // Maintain original order
  38495. return sortInput ? indexOf(sortInput, a) - indexOf(sortInput, b) : 0;
  38496. }
  38497. return compare & 4 ? -1 : 1;
  38498. } : function (a, b) {
  38499. // Exit early if the nodes are identical
  38500. if (a === b) {
  38501. hasDuplicate = true;
  38502. return 0;
  38503. }
  38504. var cur,
  38505. i = 0,
  38506. aup = a.parentNode,
  38507. bup = b.parentNode,
  38508. ap = [a],
  38509. bp = [b];
  38510. // Parentless nodes are either documents or disconnected
  38511. if (!aup || !bup) {
  38512. return a === document ? -1 : b === document ? 1 : aup ? -1 : bup ? 1 : sortInput ? indexOf(sortInput, a) - indexOf(sortInput, b) : 0;
  38513. // If the nodes are siblings, we can do a quick check
  38514. } else if (aup === bup) {
  38515. return siblingCheck(a, b);
  38516. }
  38517. // Otherwise we need full lists of their ancestors for comparison
  38518. cur = a;
  38519. while (cur = cur.parentNode) {
  38520. ap.unshift(cur);
  38521. }
  38522. cur = b;
  38523. while (cur = cur.parentNode) {
  38524. bp.unshift(cur);
  38525. }
  38526. // Walk down the tree looking for a discrepancy
  38527. while (ap[i] === bp[i]) {
  38528. i++;
  38529. }
  38530. return i ?
  38531. // Do a sibling check if the nodes have a common ancestor
  38532. siblingCheck(ap[i], bp[i]) :
  38533. // Otherwise nodes in our document sort first
  38534. ap[i] === preferredDoc ? -1 : bp[i] === preferredDoc ? 1 : 0;
  38535. };
  38536. return document;
  38537. };
  38538. Sizzle.matches = function (expr, elements) {
  38539. return Sizzle(expr, null, null, elements);
  38540. };
  38541. Sizzle.matchesSelector = function (elem, expr) {
  38542. // Set document vars if needed
  38543. if ((elem.ownerDocument || elem) !== document) {
  38544. setDocument(elem);
  38545. }
  38546. // Make sure that attribute selectors are quoted
  38547. expr = expr.replace(rattributeQuotes, "='$1']");
  38548. if (support.matchesSelector && documentIsHTML && !compilerCache[expr + " "] && (!rbuggyMatches || !rbuggyMatches.test(expr)) && (!rbuggyQSA || !rbuggyQSA.test(expr))) {
  38549. try {
  38550. var ret = matches.call(elem, expr);
  38551. // IE 9's matchesSelector returns false on disconnected nodes
  38552. if (ret || support.disconnectedMatch ||
  38553. // As well, disconnected nodes are said to be in a document
  38554. // fragment in IE 9
  38555. elem.document && elem.document.nodeType !== 11) {
  38556. return ret;
  38557. }
  38558. } catch (e) {}
  38559. }
  38560. return Sizzle(expr, document, null, [elem]).length > 0;
  38561. };
  38562. Sizzle.contains = function (context, elem) {
  38563. // Set document vars if needed
  38564. if ((context.ownerDocument || context) !== document) {
  38565. setDocument(context);
  38566. }
  38567. return contains(context, elem);
  38568. };
  38569. Sizzle.attr = function (elem, name) {
  38570. // Set document vars if needed
  38571. if ((elem.ownerDocument || elem) !== document) {
  38572. setDocument(elem);
  38573. }
  38574. var fn = Expr.attrHandle[name.toLowerCase()],
  38575. // Don't get fooled by Object.prototype properties (jQuery #13807)
  38576. val = fn && hasOwn.call(Expr.attrHandle, name.toLowerCase()) ? fn(elem, name, !documentIsHTML) : undefined;
  38577. return val !== undefined ? val : support.attributes || !documentIsHTML ? elem.getAttribute(name) : (val = elem.getAttributeNode(name)) && val.specified ? val.value : null;
  38578. };
  38579. Sizzle.escape = function (sel) {
  38580. return (sel + "").replace(rcssescape, fcssescape);
  38581. };
  38582. Sizzle.error = function (msg) {
  38583. throw new Error("Syntax error, unrecognized expression: " + msg);
  38584. };
  38585. /**
  38586. * Document sorting and removing duplicates
  38587. * @param {ArrayLike} results
  38588. */
  38589. Sizzle.uniqueSort = function (results) {
  38590. var elem,
  38591. duplicates = [],
  38592. j = 0,
  38593. i = 0;
  38594. // Unless we *know* we can detect duplicates, assume their presence
  38595. hasDuplicate = !support.detectDuplicates;
  38596. sortInput = !support.sortStable && results.slice(0);
  38597. results.sort(sortOrder);
  38598. if (hasDuplicate) {
  38599. while (elem = results[i++]) {
  38600. if (elem === results[i]) {
  38601. j = duplicates.push(i);
  38602. }
  38603. }
  38604. while (j--) {
  38605. results.splice(duplicates[j], 1);
  38606. }
  38607. }
  38608. // Clear input after sorting to release objects
  38609. // See https://github.com/jquery/sizzle/pull/225
  38610. sortInput = null;
  38611. return results;
  38612. };
  38613. /**
  38614. * Utility function for retrieving the text value of an array of DOM nodes
  38615. * @param {Array|Element} elem
  38616. */
  38617. getText = Sizzle.getText = function (elem) {
  38618. var node,
  38619. ret = "",
  38620. i = 0,
  38621. nodeType = elem.nodeType;
  38622. if (!nodeType) {
  38623. // If no nodeType, this is expected to be an array
  38624. while (node = elem[i++]) {
  38625. // Do not traverse comment nodes
  38626. ret += getText(node);
  38627. }
  38628. } else if (nodeType === 1 || nodeType === 9 || nodeType === 11) {
  38629. // Use textContent for elements
  38630. // innerText usage removed for consistency of new lines (jQuery #11153)
  38631. if (typeof elem.textContent === "string") {
  38632. return elem.textContent;
  38633. } else {
  38634. // Traverse its children
  38635. for (elem = elem.firstChild; elem; elem = elem.nextSibling) {
  38636. ret += getText(elem);
  38637. }
  38638. }
  38639. } else if (nodeType === 3 || nodeType === 4) {
  38640. return elem.nodeValue;
  38641. }
  38642. // Do not include comment or processing instruction nodes
  38643. return ret;
  38644. };
  38645. Expr = Sizzle.selectors = {
  38646. // Can be adjusted by the user
  38647. cacheLength: 50,
  38648. createPseudo: markFunction,
  38649. match: matchExpr,
  38650. attrHandle: {},
  38651. find: {},
  38652. relative: {
  38653. ">": { dir: "parentNode", first: true },
  38654. " ": { dir: "parentNode" },
  38655. "+": { dir: "previousSibling", first: true },
  38656. "~": { dir: "previousSibling" }
  38657. },
  38658. preFilter: {
  38659. "ATTR": function ATTR(match) {
  38660. match[1] = match[1].replace(runescape, funescape);
  38661. // Move the given value to match[3] whether quoted or unquoted
  38662. match[3] = (match[3] || match[4] || match[5] || "").replace(runescape, funescape);
  38663. if (match[2] === "~=") {
  38664. match[3] = " " + match[3] + " ";
  38665. }
  38666. return match.slice(0, 4);
  38667. },
  38668. "CHILD": function CHILD(match) {
  38669. /* matches from matchExpr["CHILD"]
  38670. 1 type (only|nth|...)
  38671. 2 what (child|of-type)
  38672. 3 argument (even|odd|\d*|\d*n([+-]\d+)?|...)
  38673. 4 xn-component of xn+y argument ([+-]?\d*n|)
  38674. 5 sign of xn-component
  38675. 6 x of xn-component
  38676. 7 sign of y-component
  38677. 8 y of y-component
  38678. */
  38679. match[1] = match[1].toLowerCase();
  38680. if (match[1].slice(0, 3) === "nth") {
  38681. // nth-* requires argument
  38682. if (!match[3]) {
  38683. Sizzle.error(match[0]);
  38684. }
  38685. // numeric x and y parameters for Expr.filter.CHILD
  38686. // remember that false/true cast respectively to 0/1
  38687. match[4] = +(match[4] ? match[5] + (match[6] || 1) : 2 * (match[3] === "even" || match[3] === "odd"));
  38688. match[5] = +(match[7] + match[8] || match[3] === "odd");
  38689. // other types prohibit arguments
  38690. } else if (match[3]) {
  38691. Sizzle.error(match[0]);
  38692. }
  38693. return match;
  38694. },
  38695. "PSEUDO": function PSEUDO(match) {
  38696. var excess,
  38697. unquoted = !match[6] && match[2];
  38698. if (matchExpr["CHILD"].test(match[0])) {
  38699. return null;
  38700. }
  38701. // Accept quoted arguments as-is
  38702. if (match[3]) {
  38703. match[2] = match[4] || match[5] || "";
  38704. // Strip excess characters from unquoted arguments
  38705. } else if (unquoted && rpseudo.test(unquoted) && (
  38706. // Get excess from tokenize (recursively)
  38707. excess = tokenize(unquoted, true)) && (
  38708. // advance to the next closing parenthesis
  38709. excess = unquoted.indexOf(")", unquoted.length - excess) - unquoted.length)) {
  38710. // excess is a negative index
  38711. match[0] = match[0].slice(0, excess);
  38712. match[2] = unquoted.slice(0, excess);
  38713. }
  38714. // Return only captures needed by the pseudo filter method (type and argument)
  38715. return match.slice(0, 3);
  38716. }
  38717. },
  38718. filter: {
  38719. "TAG": function TAG(nodeNameSelector) {
  38720. var nodeName = nodeNameSelector.replace(runescape, funescape).toLowerCase();
  38721. return nodeNameSelector === "*" ? function () {
  38722. return true;
  38723. } : function (elem) {
  38724. return elem.nodeName && elem.nodeName.toLowerCase() === nodeName;
  38725. };
  38726. },
  38727. "CLASS": function CLASS(className) {
  38728. var pattern = classCache[className + " "];
  38729. return pattern || (pattern = new RegExp("(^|" + whitespace + ")" + className + "(" + whitespace + "|$)")) && classCache(className, function (elem) {
  38730. return pattern.test(typeof elem.className === "string" && elem.className || typeof elem.getAttribute !== "undefined" && elem.getAttribute("class") || "");
  38731. });
  38732. },
  38733. "ATTR": function ATTR(name, operator, check) {
  38734. return function (elem) {
  38735. var result = Sizzle.attr(elem, name);
  38736. if (result == null) {
  38737. return operator === "!=";
  38738. }
  38739. if (!operator) {
  38740. return true;
  38741. }
  38742. result += "";
  38743. 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;
  38744. };
  38745. },
  38746. "CHILD": function CHILD(type, what, argument, first, last) {
  38747. var simple = type.slice(0, 3) !== "nth",
  38748. forward = type.slice(-4) !== "last",
  38749. ofType = what === "of-type";
  38750. return first === 1 && last === 0 ?
  38751. // Shortcut for :nth-*(n)
  38752. function (elem) {
  38753. return !!elem.parentNode;
  38754. } : function (elem, context, xml) {
  38755. var cache,
  38756. uniqueCache,
  38757. outerCache,
  38758. node,
  38759. nodeIndex,
  38760. start,
  38761. dir = simple !== forward ? "nextSibling" : "previousSibling",
  38762. parent = elem.parentNode,
  38763. name = ofType && elem.nodeName.toLowerCase(),
  38764. useCache = !xml && !ofType,
  38765. diff = false;
  38766. if (parent) {
  38767. // :(first|last|only)-(child|of-type)
  38768. if (simple) {
  38769. while (dir) {
  38770. node = elem;
  38771. while (node = node[dir]) {
  38772. if (ofType ? node.nodeName.toLowerCase() === name : node.nodeType === 1) {
  38773. return false;
  38774. }
  38775. }
  38776. // Reverse direction for :only-* (if we haven't yet done so)
  38777. start = dir = type === "only" && !start && "nextSibling";
  38778. }
  38779. return true;
  38780. }
  38781. start = [forward ? parent.firstChild : parent.lastChild];
  38782. // non-xml :nth-child(...) stores cache data on `parent`
  38783. if (forward && useCache) {
  38784. // Seek `elem` from a previously-cached index
  38785. // ...in a gzip-friendly way
  38786. node = parent;
  38787. outerCache = node[expando] || (node[expando] = {});
  38788. // Support: IE <9 only
  38789. // Defend against cloned attroperties (jQuery gh-1709)
  38790. uniqueCache = outerCache[node.uniqueID] || (outerCache[node.uniqueID] = {});
  38791. cache = uniqueCache[type] || [];
  38792. nodeIndex = cache[0] === dirruns && cache[1];
  38793. diff = nodeIndex && cache[2];
  38794. node = nodeIndex && parent.childNodes[nodeIndex];
  38795. while (node = ++nodeIndex && node && node[dir] || (
  38796. // Fallback to seeking `elem` from the start
  38797. diff = nodeIndex = 0) || start.pop()) {
  38798. // When found, cache indexes on `parent` and break
  38799. if (node.nodeType === 1 && ++diff && node === elem) {
  38800. uniqueCache[type] = [dirruns, nodeIndex, diff];
  38801. break;
  38802. }
  38803. }
  38804. } else {
  38805. // Use previously-cached element index if available
  38806. if (useCache) {
  38807. // ...in a gzip-friendly way
  38808. node = elem;
  38809. outerCache = node[expando] || (node[expando] = {});
  38810. // Support: IE <9 only
  38811. // Defend against cloned attroperties (jQuery gh-1709)
  38812. uniqueCache = outerCache[node.uniqueID] || (outerCache[node.uniqueID] = {});
  38813. cache = uniqueCache[type] || [];
  38814. nodeIndex = cache[0] === dirruns && cache[1];
  38815. diff = nodeIndex;
  38816. }
  38817. // xml :nth-child(...)
  38818. // or :nth-last-child(...) or :nth(-last)?-of-type(...)
  38819. if (diff === false) {
  38820. // Use the same loop as above to seek `elem` from the start
  38821. while (node = ++nodeIndex && node && node[dir] || (diff = nodeIndex = 0) || start.pop()) {
  38822. if ((ofType ? node.nodeName.toLowerCase() === name : node.nodeType === 1) && ++diff) {
  38823. // Cache the index of each encountered element
  38824. if (useCache) {
  38825. outerCache = node[expando] || (node[expando] = {});
  38826. // Support: IE <9 only
  38827. // Defend against cloned attroperties (jQuery gh-1709)
  38828. uniqueCache = outerCache[node.uniqueID] || (outerCache[node.uniqueID] = {});
  38829. uniqueCache[type] = [dirruns, diff];
  38830. }
  38831. if (node === elem) {
  38832. break;
  38833. }
  38834. }
  38835. }
  38836. }
  38837. }
  38838. // Incorporate the offset, then check against cycle size
  38839. diff -= last;
  38840. return diff === first || diff % first === 0 && diff / first >= 0;
  38841. }
  38842. };
  38843. },
  38844. "PSEUDO": function PSEUDO(pseudo, argument) {
  38845. // pseudo-class names are case-insensitive
  38846. // http://www.w3.org/TR/selectors/#pseudo-classes
  38847. // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters
  38848. // Remember that setFilters inherits from pseudos
  38849. var args,
  38850. fn = Expr.pseudos[pseudo] || Expr.setFilters[pseudo.toLowerCase()] || Sizzle.error("unsupported pseudo: " + pseudo);
  38851. // The user may use createPseudo to indicate that
  38852. // arguments are needed to create the filter function
  38853. // just as Sizzle does
  38854. if (fn[expando]) {
  38855. return fn(argument);
  38856. }
  38857. // But maintain support for old signatures
  38858. if (fn.length > 1) {
  38859. args = [pseudo, pseudo, "", argument];
  38860. return Expr.setFilters.hasOwnProperty(pseudo.toLowerCase()) ? markFunction(function (seed, matches) {
  38861. var idx,
  38862. matched = fn(seed, argument),
  38863. i = matched.length;
  38864. while (i--) {
  38865. idx = indexOf(seed, matched[i]);
  38866. seed[idx] = !(matches[idx] = matched[i]);
  38867. }
  38868. }) : function (elem) {
  38869. return fn(elem, 0, args);
  38870. };
  38871. }
  38872. return fn;
  38873. }
  38874. },
  38875. pseudos: {
  38876. // Potentially complex pseudos
  38877. "not": markFunction(function (selector) {
  38878. // Trim the selector passed to compile
  38879. // to avoid treating leading and trailing
  38880. // spaces as combinators
  38881. var input = [],
  38882. results = [],
  38883. matcher = compile(selector.replace(rtrim, "$1"));
  38884. return matcher[expando] ? markFunction(function (seed, matches, context, xml) {
  38885. var elem,
  38886. unmatched = matcher(seed, null, xml, []),
  38887. i = seed.length;
  38888. // Match elements unmatched by `matcher`
  38889. while (i--) {
  38890. if (elem = unmatched[i]) {
  38891. seed[i] = !(matches[i] = elem);
  38892. }
  38893. }
  38894. }) : function (elem, context, xml) {
  38895. input[0] = elem;
  38896. matcher(input, null, xml, results);
  38897. // Don't keep the element (issue #299)
  38898. input[0] = null;
  38899. return !results.pop();
  38900. };
  38901. }),
  38902. "has": markFunction(function (selector) {
  38903. return function (elem) {
  38904. return Sizzle(selector, elem).length > 0;
  38905. };
  38906. }),
  38907. "contains": markFunction(function (text) {
  38908. text = text.replace(runescape, funescape);
  38909. return function (elem) {
  38910. return (elem.textContent || elem.innerText || getText(elem)).indexOf(text) > -1;
  38911. };
  38912. }),
  38913. // "Whether an element is represented by a :lang() selector
  38914. // is based solely on the element's language value
  38915. // being equal to the identifier C,
  38916. // or beginning with the identifier C immediately followed by "-".
  38917. // The matching of C against the element's language value is performed case-insensitively.
  38918. // The identifier C does not have to be a valid language name."
  38919. // http://www.w3.org/TR/selectors/#lang-pseudo
  38920. "lang": markFunction(function (lang) {
  38921. // lang value must be a valid identifier
  38922. if (!ridentifier.test(lang || "")) {
  38923. Sizzle.error("unsupported lang: " + lang);
  38924. }
  38925. lang = lang.replace(runescape, funescape).toLowerCase();
  38926. return function (elem) {
  38927. var elemLang;
  38928. do {
  38929. if (elemLang = documentIsHTML ? elem.lang : elem.getAttribute("xml:lang") || elem.getAttribute("lang")) {
  38930. elemLang = elemLang.toLowerCase();
  38931. return elemLang === lang || elemLang.indexOf(lang + "-") === 0;
  38932. }
  38933. } while ((elem = elem.parentNode) && elem.nodeType === 1);
  38934. return false;
  38935. };
  38936. }),
  38937. // Miscellaneous
  38938. "target": function target(elem) {
  38939. var hash = window.location && window.location.hash;
  38940. return hash && hash.slice(1) === elem.id;
  38941. },
  38942. "root": function root(elem) {
  38943. return elem === docElem;
  38944. },
  38945. "focus": function focus(elem) {
  38946. return elem === document.activeElement && (!document.hasFocus || document.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex);
  38947. },
  38948. // Boolean properties
  38949. "enabled": createDisabledPseudo(false),
  38950. "disabled": createDisabledPseudo(true),
  38951. "checked": function checked(elem) {
  38952. // In CSS3, :checked should return both checked and selected elements
  38953. // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
  38954. var nodeName = elem.nodeName.toLowerCase();
  38955. return nodeName === "input" && !!elem.checked || nodeName === "option" && !!elem.selected;
  38956. },
  38957. "selected": function selected(elem) {
  38958. // Accessing this property makes selected-by-default
  38959. // options in Safari work properly
  38960. if (elem.parentNode) {
  38961. elem.parentNode.selectedIndex;
  38962. }
  38963. return elem.selected === true;
  38964. },
  38965. // Contents
  38966. "empty": function empty(elem) {
  38967. // http://www.w3.org/TR/selectors/#empty-pseudo
  38968. // :empty is negated by element (1) or content nodes (text: 3; cdata: 4; entity ref: 5),
  38969. // but not by others (comment: 8; processing instruction: 7; etc.)
  38970. // nodeType < 6 works because attributes (2) do not appear as children
  38971. for (elem = elem.firstChild; elem; elem = elem.nextSibling) {
  38972. if (elem.nodeType < 6) {
  38973. return false;
  38974. }
  38975. }
  38976. return true;
  38977. },
  38978. "parent": function parent(elem) {
  38979. return !Expr.pseudos["empty"](elem);
  38980. },
  38981. // Element/input types
  38982. "header": function header(elem) {
  38983. return rheader.test(elem.nodeName);
  38984. },
  38985. "input": function input(elem) {
  38986. return rinputs.test(elem.nodeName);
  38987. },
  38988. "button": function button(elem) {
  38989. var name = elem.nodeName.toLowerCase();
  38990. return name === "input" && elem.type === "button" || name === "button";
  38991. },
  38992. "text": function text(elem) {
  38993. var attr;
  38994. return elem.nodeName.toLowerCase() === "input" && elem.type === "text" && (
  38995. // Support: IE<8
  38996. // New HTML5 attribute values (e.g., "search") appear with elem.type === "text"
  38997. (attr = elem.getAttribute("type")) == null || attr.toLowerCase() === "text");
  38998. },
  38999. // Position-in-collection
  39000. "first": createPositionalPseudo(function () {
  39001. return [0];
  39002. }),
  39003. "last": createPositionalPseudo(function (matchIndexes, length) {
  39004. return [length - 1];
  39005. }),
  39006. "eq": createPositionalPseudo(function (matchIndexes, length, argument) {
  39007. return [argument < 0 ? argument + length : argument];
  39008. }),
  39009. "even": createPositionalPseudo(function (matchIndexes, length) {
  39010. var i = 0;
  39011. for (; i < length; i += 2) {
  39012. matchIndexes.push(i);
  39013. }
  39014. return matchIndexes;
  39015. }),
  39016. "odd": createPositionalPseudo(function (matchIndexes, length) {
  39017. var i = 1;
  39018. for (; i < length; i += 2) {
  39019. matchIndexes.push(i);
  39020. }
  39021. return matchIndexes;
  39022. }),
  39023. "lt": createPositionalPseudo(function (matchIndexes, length, argument) {
  39024. var i = argument < 0 ? argument + length : argument;
  39025. for (; --i >= 0;) {
  39026. matchIndexes.push(i);
  39027. }
  39028. return matchIndexes;
  39029. }),
  39030. "gt": createPositionalPseudo(function (matchIndexes, length, argument) {
  39031. var i = argument < 0 ? argument + length : argument;
  39032. for (; ++i < length;) {
  39033. matchIndexes.push(i);
  39034. }
  39035. return matchIndexes;
  39036. })
  39037. }
  39038. };
  39039. Expr.pseudos["nth"] = Expr.pseudos["eq"];
  39040. // Add button/input type pseudos
  39041. for (i in { radio: true, checkbox: true, file: true, password: true, image: true }) {
  39042. Expr.pseudos[i] = createInputPseudo(i);
  39043. }
  39044. for (i in { submit: true, reset: true }) {
  39045. Expr.pseudos[i] = createButtonPseudo(i);
  39046. }
  39047. // Easy API for creating new setFilters
  39048. function setFilters() {}
  39049. setFilters.prototype = Expr.filters = Expr.pseudos;
  39050. Expr.setFilters = new setFilters();
  39051. tokenize = Sizzle.tokenize = function (selector, parseOnly) {
  39052. var matched,
  39053. match,
  39054. tokens,
  39055. type,
  39056. soFar,
  39057. groups,
  39058. preFilters,
  39059. cached = tokenCache[selector + " "];
  39060. if (cached) {
  39061. return parseOnly ? 0 : cached.slice(0);
  39062. }
  39063. soFar = selector;
  39064. groups = [];
  39065. preFilters = Expr.preFilter;
  39066. while (soFar) {
  39067. // Comma and first run
  39068. if (!matched || (match = rcomma.exec(soFar))) {
  39069. if (match) {
  39070. // Don't consume trailing commas as valid
  39071. soFar = soFar.slice(match[0].length) || soFar;
  39072. }
  39073. groups.push(tokens = []);
  39074. }
  39075. matched = false;
  39076. // Combinators
  39077. if (match = rcombinators.exec(soFar)) {
  39078. matched = match.shift();
  39079. tokens.push({
  39080. value: matched,
  39081. // Cast descendant combinators to space
  39082. type: match[0].replace(rtrim, " ")
  39083. });
  39084. soFar = soFar.slice(matched.length);
  39085. }
  39086. // Filters
  39087. for (type in Expr.filter) {
  39088. if ((match = matchExpr[type].exec(soFar)) && (!preFilters[type] || (match = preFilters[type](match)))) {
  39089. matched = match.shift();
  39090. tokens.push({
  39091. value: matched,
  39092. type: type,
  39093. matches: match
  39094. });
  39095. soFar = soFar.slice(matched.length);
  39096. }
  39097. }
  39098. if (!matched) {
  39099. break;
  39100. }
  39101. }
  39102. // Return the length of the invalid excess
  39103. // if we're just parsing
  39104. // Otherwise, throw an error or return tokens
  39105. return parseOnly ? soFar.length : soFar ? Sizzle.error(selector) :
  39106. // Cache the tokens
  39107. tokenCache(selector, groups).slice(0);
  39108. };
  39109. function toSelector(tokens) {
  39110. var i = 0,
  39111. len = tokens.length,
  39112. selector = "";
  39113. for (; i < len; i++) {
  39114. selector += tokens[i].value;
  39115. }
  39116. return selector;
  39117. }
  39118. function addCombinator(matcher, combinator, base) {
  39119. var dir = combinator.dir,
  39120. skip = combinator.next,
  39121. key = skip || dir,
  39122. checkNonElements = base && key === "parentNode",
  39123. doneName = done++;
  39124. return combinator.first ?
  39125. // Check against closest ancestor/preceding element
  39126. function (elem, context, xml) {
  39127. while (elem = elem[dir]) {
  39128. if (elem.nodeType === 1 || checkNonElements) {
  39129. return matcher(elem, context, xml);
  39130. }
  39131. }
  39132. return false;
  39133. } :
  39134. // Check against all ancestor/preceding elements
  39135. function (elem, context, xml) {
  39136. var oldCache,
  39137. uniqueCache,
  39138. outerCache,
  39139. newCache = [dirruns, doneName];
  39140. // We can't set arbitrary data on XML nodes, so they don't benefit from combinator caching
  39141. if (xml) {
  39142. while (elem = elem[dir]) {
  39143. if (elem.nodeType === 1 || checkNonElements) {
  39144. if (matcher(elem, context, xml)) {
  39145. return true;
  39146. }
  39147. }
  39148. }
  39149. } else {
  39150. while (elem = elem[dir]) {
  39151. if (elem.nodeType === 1 || checkNonElements) {
  39152. outerCache = elem[expando] || (elem[expando] = {});
  39153. // Support: IE <9 only
  39154. // Defend against cloned attroperties (jQuery gh-1709)
  39155. uniqueCache = outerCache[elem.uniqueID] || (outerCache[elem.uniqueID] = {});
  39156. if (skip && skip === elem.nodeName.toLowerCase()) {
  39157. elem = elem[dir] || elem;
  39158. } else if ((oldCache = uniqueCache[key]) && oldCache[0] === dirruns && oldCache[1] === doneName) {
  39159. // Assign to newCache so results back-propagate to previous elements
  39160. return newCache[2] = oldCache[2];
  39161. } else {
  39162. // Reuse newcache so results back-propagate to previous elements
  39163. uniqueCache[key] = newCache;
  39164. // A match means we're done; a fail means we have to keep checking
  39165. if (newCache[2] = matcher(elem, context, xml)) {
  39166. return true;
  39167. }
  39168. }
  39169. }
  39170. }
  39171. }
  39172. return false;
  39173. };
  39174. }
  39175. function elementMatcher(matchers) {
  39176. return matchers.length > 1 ? function (elem, context, xml) {
  39177. var i = matchers.length;
  39178. while (i--) {
  39179. if (!matchers[i](elem, context, xml)) {
  39180. return false;
  39181. }
  39182. }
  39183. return true;
  39184. } : matchers[0];
  39185. }
  39186. function multipleContexts(selector, contexts, results) {
  39187. var i = 0,
  39188. len = contexts.length;
  39189. for (; i < len; i++) {
  39190. Sizzle(selector, contexts[i], results);
  39191. }
  39192. return results;
  39193. }
  39194. function condense(unmatched, map, filter, context, xml) {
  39195. var elem,
  39196. newUnmatched = [],
  39197. i = 0,
  39198. len = unmatched.length,
  39199. mapped = map != null;
  39200. for (; i < len; i++) {
  39201. if (elem = unmatched[i]) {
  39202. if (!filter || filter(elem, context, xml)) {
  39203. newUnmatched.push(elem);
  39204. if (mapped) {
  39205. map.push(i);
  39206. }
  39207. }
  39208. }
  39209. }
  39210. return newUnmatched;
  39211. }
  39212. function setMatcher(preFilter, selector, matcher, postFilter, postFinder, postSelector) {
  39213. if (postFilter && !postFilter[expando]) {
  39214. postFilter = setMatcher(postFilter);
  39215. }
  39216. if (postFinder && !postFinder[expando]) {
  39217. postFinder = setMatcher(postFinder, postSelector);
  39218. }
  39219. return markFunction(function (seed, results, context, xml) {
  39220. var temp,
  39221. i,
  39222. elem,
  39223. preMap = [],
  39224. postMap = [],
  39225. preexisting = results.length,
  39226. // Get initial elements from seed or context
  39227. elems = seed || multipleContexts(selector || "*", context.nodeType ? [context] : context, []),
  39228. // Prefilter to get matcher input, preserving a map for seed-results synchronization
  39229. matcherIn = preFilter && (seed || !selector) ? condense(elems, preMap, preFilter, context, xml) : elems,
  39230. matcherOut = matcher ?
  39231. // If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results,
  39232. postFinder || (seed ? preFilter : preexisting || postFilter) ?
  39233. // ...intermediate processing is necessary
  39234. [] :
  39235. // ...otherwise use results directly
  39236. results : matcherIn;
  39237. // Find primary matches
  39238. if (matcher) {
  39239. matcher(matcherIn, matcherOut, context, xml);
  39240. }
  39241. // Apply postFilter
  39242. if (postFilter) {
  39243. temp = condense(matcherOut, postMap);
  39244. postFilter(temp, [], context, xml);
  39245. // Un-match failing elements by moving them back to matcherIn
  39246. i = temp.length;
  39247. while (i--) {
  39248. if (elem = temp[i]) {
  39249. matcherOut[postMap[i]] = !(matcherIn[postMap[i]] = elem);
  39250. }
  39251. }
  39252. }
  39253. if (seed) {
  39254. if (postFinder || preFilter) {
  39255. if (postFinder) {
  39256. // Get the final matcherOut by condensing this intermediate into postFinder contexts
  39257. temp = [];
  39258. i = matcherOut.length;
  39259. while (i--) {
  39260. if (elem = matcherOut[i]) {
  39261. // Restore matcherIn since elem is not yet a final match
  39262. temp.push(matcherIn[i] = elem);
  39263. }
  39264. }
  39265. postFinder(null, matcherOut = [], temp, xml);
  39266. }
  39267. // Move matched elements from seed to results to keep them synchronized
  39268. i = matcherOut.length;
  39269. while (i--) {
  39270. if ((elem = matcherOut[i]) && (temp = postFinder ? indexOf(seed, elem) : preMap[i]) > -1) {
  39271. seed[temp] = !(results[temp] = elem);
  39272. }
  39273. }
  39274. }
  39275. // Add elements to results, through postFinder if defined
  39276. } else {
  39277. matcherOut = condense(matcherOut === results ? matcherOut.splice(preexisting, matcherOut.length) : matcherOut);
  39278. if (postFinder) {
  39279. postFinder(null, results, matcherOut, xml);
  39280. } else {
  39281. push.apply(results, matcherOut);
  39282. }
  39283. }
  39284. });
  39285. }
  39286. function matcherFromTokens(tokens) {
  39287. var checkContext,
  39288. matcher,
  39289. j,
  39290. len = tokens.length,
  39291. leadingRelative = Expr.relative[tokens[0].type],
  39292. implicitRelative = leadingRelative || Expr.relative[" "],
  39293. i = leadingRelative ? 1 : 0,
  39294. // The foundational matcher ensures that elements are reachable from top-level context(s)
  39295. matchContext = addCombinator(function (elem) {
  39296. return elem === checkContext;
  39297. }, implicitRelative, true),
  39298. matchAnyContext = addCombinator(function (elem) {
  39299. return indexOf(checkContext, elem) > -1;
  39300. }, implicitRelative, true),
  39301. matchers = [function (elem, context, xml) {
  39302. var ret = !leadingRelative && (xml || context !== outermostContext) || ((checkContext = context).nodeType ? matchContext(elem, context, xml) : matchAnyContext(elem, context, xml));
  39303. // Avoid hanging onto element (issue #299)
  39304. checkContext = null;
  39305. return ret;
  39306. }];
  39307. for (; i < len; i++) {
  39308. if (matcher = Expr.relative[tokens[i].type]) {
  39309. matchers = [addCombinator(elementMatcher(matchers), matcher)];
  39310. } else {
  39311. matcher = Expr.filter[tokens[i].type].apply(null, tokens[i].matches);
  39312. // Return special upon seeing a positional matcher
  39313. if (matcher[expando]) {
  39314. // Find the next relative operator (if any) for proper handling
  39315. j = ++i;
  39316. for (; j < len; j++) {
  39317. if (Expr.relative[tokens[j].type]) {
  39318. break;
  39319. }
  39320. }
  39321. return setMatcher(i > 1 && elementMatcher(matchers), i > 1 && toSelector(
  39322. // If the preceding token was a descendant combinator, insert an implicit any-element `*`
  39323. 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));
  39324. }
  39325. matchers.push(matcher);
  39326. }
  39327. }
  39328. return elementMatcher(matchers);
  39329. }
  39330. function matcherFromGroupMatchers(elementMatchers, setMatchers) {
  39331. var bySet = setMatchers.length > 0,
  39332. byElement = elementMatchers.length > 0,
  39333. superMatcher = function superMatcher(seed, context, xml, results, outermost) {
  39334. var elem,
  39335. j,
  39336. matcher,
  39337. matchedCount = 0,
  39338. i = "0",
  39339. unmatched = seed && [],
  39340. setMatched = [],
  39341. contextBackup = outermostContext,
  39342. // We must always have either seed elements or outermost context
  39343. elems = seed || byElement && Expr.find["TAG"]("*", outermost),
  39344. // Use integer dirruns iff this is the outermost matcher
  39345. dirrunsUnique = dirruns += contextBackup == null ? 1 : Math.random() || 0.1,
  39346. len = elems.length;
  39347. if (outermost) {
  39348. outermostContext = context === document || context || outermost;
  39349. }
  39350. // Add elements passing elementMatchers directly to results
  39351. // Support: IE<9, Safari
  39352. // Tolerate NodeList properties (IE: "length"; Safari: <number>) matching elements by id
  39353. for (; i !== len && (elem = elems[i]) != null; i++) {
  39354. if (byElement && elem) {
  39355. j = 0;
  39356. if (!context && elem.ownerDocument !== document) {
  39357. setDocument(elem);
  39358. xml = !documentIsHTML;
  39359. }
  39360. while (matcher = elementMatchers[j++]) {
  39361. if (matcher(elem, context || document, xml)) {
  39362. results.push(elem);
  39363. break;
  39364. }
  39365. }
  39366. if (outermost) {
  39367. dirruns = dirrunsUnique;
  39368. }
  39369. }
  39370. // Track unmatched elements for set filters
  39371. if (bySet) {
  39372. // They will have gone through all possible matchers
  39373. if (elem = !matcher && elem) {
  39374. matchedCount--;
  39375. }
  39376. // Lengthen the array for every element, matched or not
  39377. if (seed) {
  39378. unmatched.push(elem);
  39379. }
  39380. }
  39381. }
  39382. // `i` is now the count of elements visited above, and adding it to `matchedCount`
  39383. // makes the latter nonnegative.
  39384. matchedCount += i;
  39385. // Apply set filters to unmatched elements
  39386. // NOTE: This can be skipped if there are no unmatched elements (i.e., `matchedCount`
  39387. // equals `i`), unless we didn't visit _any_ elements in the above loop because we have
  39388. // no element matchers and no seed.
  39389. // Incrementing an initially-string "0" `i` allows `i` to remain a string only in that
  39390. // case, which will result in a "00" `matchedCount` that differs from `i` but is also
  39391. // numerically zero.
  39392. if (bySet && i !== matchedCount) {
  39393. j = 0;
  39394. while (matcher = setMatchers[j++]) {
  39395. matcher(unmatched, setMatched, context, xml);
  39396. }
  39397. if (seed) {
  39398. // Reintegrate element matches to eliminate the need for sorting
  39399. if (matchedCount > 0) {
  39400. while (i--) {
  39401. if (!(unmatched[i] || setMatched[i])) {
  39402. setMatched[i] = pop.call(results);
  39403. }
  39404. }
  39405. }
  39406. // Discard index placeholder values to get only actual matches
  39407. setMatched = condense(setMatched);
  39408. }
  39409. // Add matches to results
  39410. push.apply(results, setMatched);
  39411. // Seedless set matches succeeding multiple successful matchers stipulate sorting
  39412. if (outermost && !seed && setMatched.length > 0 && matchedCount + setMatchers.length > 1) {
  39413. Sizzle.uniqueSort(results);
  39414. }
  39415. }
  39416. // Override manipulation of globals by nested matchers
  39417. if (outermost) {
  39418. dirruns = dirrunsUnique;
  39419. outermostContext = contextBackup;
  39420. }
  39421. return unmatched;
  39422. };
  39423. return bySet ? markFunction(superMatcher) : superMatcher;
  39424. }
  39425. compile = Sizzle.compile = function (selector, match /* Internal Use Only */) {
  39426. var i,
  39427. setMatchers = [],
  39428. elementMatchers = [],
  39429. cached = compilerCache[selector + " "];
  39430. if (!cached) {
  39431. // Generate a function of recursive functions that can be used to check each element
  39432. if (!match) {
  39433. match = tokenize(selector);
  39434. }
  39435. i = match.length;
  39436. while (i--) {
  39437. cached = matcherFromTokens(match[i]);
  39438. if (cached[expando]) {
  39439. setMatchers.push(cached);
  39440. } else {
  39441. elementMatchers.push(cached);
  39442. }
  39443. }
  39444. // Cache the compiled function
  39445. cached = compilerCache(selector, matcherFromGroupMatchers(elementMatchers, setMatchers));
  39446. // Save selector and tokenization
  39447. cached.selector = selector;
  39448. }
  39449. return cached;
  39450. };
  39451. /**
  39452. * A low-level selection function that works with Sizzle's compiled
  39453. * selector functions
  39454. * @param {String|Function} selector A selector or a pre-compiled
  39455. * selector function built with Sizzle.compile
  39456. * @param {Element} context
  39457. * @param {Array} [results]
  39458. * @param {Array} [seed] A set of elements to match against
  39459. */
  39460. select = Sizzle.select = function (selector, context, results, seed) {
  39461. var i,
  39462. tokens,
  39463. token,
  39464. type,
  39465. find,
  39466. compiled = typeof selector === "function" && selector,
  39467. match = !seed && tokenize(selector = compiled.selector || selector);
  39468. results = results || [];
  39469. // Try to minimize operations if there is only one selector in the list and no seed
  39470. // (the latter of which guarantees us context)
  39471. if (match.length === 1) {
  39472. // Reduce context if the leading compound selector is an ID
  39473. tokens = match[0] = match[0].slice(0);
  39474. if (tokens.length > 2 && (token = tokens[0]).type === "ID" && context.nodeType === 9 && documentIsHTML && Expr.relative[tokens[1].type]) {
  39475. context = (Expr.find["ID"](token.matches[0].replace(runescape, funescape), context) || [])[0];
  39476. if (!context) {
  39477. return results;
  39478. // Precompiled matchers will still verify ancestry, so step up a level
  39479. } else if (compiled) {
  39480. context = context.parentNode;
  39481. }
  39482. selector = selector.slice(tokens.shift().value.length);
  39483. }
  39484. // Fetch a seed set for right-to-left matching
  39485. i = matchExpr["needsContext"].test(selector) ? 0 : tokens.length;
  39486. while (i--) {
  39487. token = tokens[i];
  39488. // Abort if we hit a combinator
  39489. if (Expr.relative[type = token.type]) {
  39490. break;
  39491. }
  39492. if (find = Expr.find[type]) {
  39493. // Search, expanding context for leading sibling combinators
  39494. if (seed = find(token.matches[0].replace(runescape, funescape), rsibling.test(tokens[0].type) && testContext(context.parentNode) || context)) {
  39495. // If seed is empty or no tokens remain, we can return early
  39496. tokens.splice(i, 1);
  39497. selector = seed.length && toSelector(tokens);
  39498. if (!selector) {
  39499. push.apply(results, seed);
  39500. return results;
  39501. }
  39502. break;
  39503. }
  39504. }
  39505. }
  39506. }
  39507. // Compile and execute a filtering function if one is not provided
  39508. // Provide `match` to avoid retokenization if we modified the selector above
  39509. (compiled || compile(selector, match))(seed, context, !documentIsHTML, results, !context || rsibling.test(selector) && testContext(context.parentNode) || context);
  39510. return results;
  39511. };
  39512. // One-time assignments
  39513. // Sort stability
  39514. support.sortStable = expando.split("").sort(sortOrder).join("") === expando;
  39515. // Support: Chrome 14-35+
  39516. // Always assume duplicates if they aren't passed to the comparison function
  39517. support.detectDuplicates = !!hasDuplicate;
  39518. // Initialize against the default document
  39519. setDocument();
  39520. // Support: Webkit<537.32 - Safari 6.0.3/Chrome 25 (fixed in Chrome 27)
  39521. // Detached nodes confoundingly follow *each other*
  39522. support.sortDetached = assert(function (el) {
  39523. // Should return 1, but returns 4 (following)
  39524. return el.compareDocumentPosition(document.createElement("fieldset")) & 1;
  39525. });
  39526. // Support: IE<8
  39527. // Prevent attribute/property "interpolation"
  39528. // https://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx
  39529. if (!assert(function (el) {
  39530. el.innerHTML = "<a href='#'></a>";
  39531. return el.firstChild.getAttribute("href") === "#";
  39532. })) {
  39533. addHandle("type|href|height|width", function (elem, name, isXML) {
  39534. if (!isXML) {
  39535. return elem.getAttribute(name, name.toLowerCase() === "type" ? 1 : 2);
  39536. }
  39537. });
  39538. }
  39539. // Support: IE<9
  39540. // Use defaultValue in place of getAttribute("value")
  39541. if (!support.attributes || !assert(function (el) {
  39542. el.innerHTML = "<input/>";
  39543. el.firstChild.setAttribute("value", "");
  39544. return el.firstChild.getAttribute("value") === "";
  39545. })) {
  39546. addHandle("value", function (elem, name, isXML) {
  39547. if (!isXML && elem.nodeName.toLowerCase() === "input") {
  39548. return elem.defaultValue;
  39549. }
  39550. });
  39551. }
  39552. // Support: IE<9
  39553. // Use getAttributeNode to fetch booleans when getAttribute lies
  39554. if (!assert(function (el) {
  39555. return el.getAttribute("disabled") == null;
  39556. })) {
  39557. addHandle(booleans, function (elem, name, isXML) {
  39558. var val;
  39559. if (!isXML) {
  39560. return elem[name] === true ? name.toLowerCase() : (val = elem.getAttributeNode(name)) && val.specified ? val.value : null;
  39561. }
  39562. });
  39563. }
  39564. return Sizzle;
  39565. }(window);
  39566. jQuery.find = Sizzle;
  39567. jQuery.expr = Sizzle.selectors;
  39568. // Deprecated
  39569. jQuery.expr[":"] = jQuery.expr.pseudos;
  39570. jQuery.uniqueSort = jQuery.unique = Sizzle.uniqueSort;
  39571. jQuery.text = Sizzle.getText;
  39572. jQuery.isXMLDoc = Sizzle.isXML;
  39573. jQuery.contains = Sizzle.contains;
  39574. jQuery.escapeSelector = Sizzle.escape;
  39575. var dir = function dir(elem, _dir, until) {
  39576. var matched = [],
  39577. truncate = until !== undefined;
  39578. while ((elem = elem[_dir]) && elem.nodeType !== 9) {
  39579. if (elem.nodeType === 1) {
  39580. if (truncate && jQuery(elem).is(until)) {
  39581. break;
  39582. }
  39583. matched.push(elem);
  39584. }
  39585. }
  39586. return matched;
  39587. };
  39588. var _siblings = function _siblings(n, elem) {
  39589. var matched = [];
  39590. for (; n; n = n.nextSibling) {
  39591. if (n.nodeType === 1 && n !== elem) {
  39592. matched.push(n);
  39593. }
  39594. }
  39595. return matched;
  39596. };
  39597. var rneedsContext = jQuery.expr.match.needsContext;
  39598. function nodeName(elem, name) {
  39599. return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase();
  39600. };
  39601. var rsingleTag = /^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i;
  39602. // Implement the identical functionality for filter and not
  39603. function winnow(elements, qualifier, not) {
  39604. if (isFunction(qualifier)) {
  39605. return jQuery.grep(elements, function (elem, i) {
  39606. return !!qualifier.call(elem, i, elem) !== not;
  39607. });
  39608. }
  39609. // Single element
  39610. if (qualifier.nodeType) {
  39611. return jQuery.grep(elements, function (elem) {
  39612. return elem === qualifier !== not;
  39613. });
  39614. }
  39615. // Arraylike of elements (jQuery, arguments, Array)
  39616. if (typeof qualifier !== "string") {
  39617. return jQuery.grep(elements, function (elem) {
  39618. return indexOf.call(qualifier, elem) > -1 !== not;
  39619. });
  39620. }
  39621. // Filtered directly for both simple and complex selectors
  39622. return jQuery.filter(qualifier, elements, not);
  39623. }
  39624. jQuery.filter = function (expr, elems, not) {
  39625. var elem = elems[0];
  39626. if (not) {
  39627. expr = ":not(" + expr + ")";
  39628. }
  39629. if (elems.length === 1 && elem.nodeType === 1) {
  39630. return jQuery.find.matchesSelector(elem, expr) ? [elem] : [];
  39631. }
  39632. return jQuery.find.matches(expr, jQuery.grep(elems, function (elem) {
  39633. return elem.nodeType === 1;
  39634. }));
  39635. };
  39636. jQuery.fn.extend({
  39637. find: function find(selector) {
  39638. var i,
  39639. ret,
  39640. len = this.length,
  39641. self = this;
  39642. if (typeof selector !== "string") {
  39643. return this.pushStack(jQuery(selector).filter(function () {
  39644. for (i = 0; i < len; i++) {
  39645. if (jQuery.contains(self[i], this)) {
  39646. return true;
  39647. }
  39648. }
  39649. }));
  39650. }
  39651. ret = this.pushStack([]);
  39652. for (i = 0; i < len; i++) {
  39653. jQuery.find(selector, self[i], ret);
  39654. }
  39655. return len > 1 ? jQuery.uniqueSort(ret) : ret;
  39656. },
  39657. filter: function filter(selector) {
  39658. return this.pushStack(winnow(this, selector || [], false));
  39659. },
  39660. not: function not(selector) {
  39661. return this.pushStack(winnow(this, selector || [], true));
  39662. },
  39663. is: function is(selector) {
  39664. return !!winnow(this,
  39665. // If this is a positional/relative selector, check membership in the returned set
  39666. // so $("p:first").is("p:last") won't return true for a doc with two "p".
  39667. typeof selector === "string" && rneedsContext.test(selector) ? jQuery(selector) : selector || [], false).length;
  39668. }
  39669. });
  39670. // Initialize a jQuery object
  39671. // A central reference to the root jQuery(document)
  39672. var rootjQuery,
  39673. // A simple way to check for HTML strings
  39674. // Prioritize #id over <tag> to avoid XSS via location.hash (#9521)
  39675. // Strict HTML recognition (#11290: must start with <)
  39676. // Shortcut simple #id case for speed
  39677. rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/,
  39678. init = jQuery.fn.init = function (selector, context, root) {
  39679. var match, elem;
  39680. // HANDLE: $(""), $(null), $(undefined), $(false)
  39681. if (!selector) {
  39682. return this;
  39683. }
  39684. // Method init() accepts an alternate rootjQuery
  39685. // so migrate can support jQuery.sub (gh-2101)
  39686. root = root || rootjQuery;
  39687. // Handle HTML strings
  39688. if (typeof selector === "string") {
  39689. if (selector[0] === "<" && selector[selector.length - 1] === ">" && selector.length >= 3) {
  39690. // Assume that strings that start and end with <> are HTML and skip the regex check
  39691. match = [null, selector, null];
  39692. } else {
  39693. match = rquickExpr.exec(selector);
  39694. }
  39695. // Match html or make sure no context is specified for #id
  39696. if (match && (match[1] || !context)) {
  39697. // HANDLE: $(html) -> $(array)
  39698. if (match[1]) {
  39699. context = context instanceof jQuery ? context[0] : context;
  39700. // Option to run scripts is true for back-compat
  39701. // Intentionally let the error be thrown if parseHTML is not present
  39702. jQuery.merge(this, jQuery.parseHTML(match[1], context && context.nodeType ? context.ownerDocument || context : document, true));
  39703. // HANDLE: $(html, props)
  39704. if (rsingleTag.test(match[1]) && jQuery.isPlainObject(context)) {
  39705. for (match in context) {
  39706. // Properties of context are called as methods if possible
  39707. if (isFunction(this[match])) {
  39708. this[match](context[match]);
  39709. // ...and otherwise set as attributes
  39710. } else {
  39711. this.attr(match, context[match]);
  39712. }
  39713. }
  39714. }
  39715. return this;
  39716. // HANDLE: $(#id)
  39717. } else {
  39718. elem = document.getElementById(match[2]);
  39719. if (elem) {
  39720. // Inject the element directly into the jQuery object
  39721. this[0] = elem;
  39722. this.length = 1;
  39723. }
  39724. return this;
  39725. }
  39726. // HANDLE: $(expr, $(...))
  39727. } else if (!context || context.jquery) {
  39728. return (context || root).find(selector);
  39729. // HANDLE: $(expr, context)
  39730. // (which is just equivalent to: $(context).find(expr)
  39731. } else {
  39732. return this.constructor(context).find(selector);
  39733. }
  39734. // HANDLE: $(DOMElement)
  39735. } else if (selector.nodeType) {
  39736. this[0] = selector;
  39737. this.length = 1;
  39738. return this;
  39739. // HANDLE: $(function)
  39740. // Shortcut for document ready
  39741. } else if (isFunction(selector)) {
  39742. return root.ready !== undefined ? root.ready(selector) :
  39743. // Execute immediately if ready is not present
  39744. selector(jQuery);
  39745. }
  39746. return jQuery.makeArray(selector, this);
  39747. };
  39748. // Give the init function the jQuery prototype for later instantiation
  39749. init.prototype = jQuery.fn;
  39750. // Initialize central reference
  39751. rootjQuery = jQuery(document);
  39752. var rparentsprev = /^(?:parents|prev(?:Until|All))/,
  39753. // Methods guaranteed to produce a unique set when starting from a unique set
  39754. guaranteedUnique = {
  39755. children: true,
  39756. contents: true,
  39757. next: true,
  39758. prev: true
  39759. };
  39760. jQuery.fn.extend({
  39761. has: function has(target) {
  39762. var targets = jQuery(target, this),
  39763. l = targets.length;
  39764. return this.filter(function () {
  39765. var i = 0;
  39766. for (; i < l; i++) {
  39767. if (jQuery.contains(this, targets[i])) {
  39768. return true;
  39769. }
  39770. }
  39771. });
  39772. },
  39773. closest: function closest(selectors, context) {
  39774. var cur,
  39775. i = 0,
  39776. l = this.length,
  39777. matched = [],
  39778. targets = typeof selectors !== "string" && jQuery(selectors);
  39779. // Positional selectors never match, since there's no _selection_ context
  39780. if (!rneedsContext.test(selectors)) {
  39781. for (; i < l; i++) {
  39782. for (cur = this[i]; cur && cur !== context; cur = cur.parentNode) {
  39783. // Always skip document fragments
  39784. if (cur.nodeType < 11 && (targets ? targets.index(cur) > -1 :
  39785. // Don't pass non-elements to Sizzle
  39786. cur.nodeType === 1 && jQuery.find.matchesSelector(cur, selectors))) {
  39787. matched.push(cur);
  39788. break;
  39789. }
  39790. }
  39791. }
  39792. }
  39793. return this.pushStack(matched.length > 1 ? jQuery.uniqueSort(matched) : matched);
  39794. },
  39795. // Determine the position of an element within the set
  39796. index: function index(elem) {
  39797. // No argument, return index in parent
  39798. if (!elem) {
  39799. return this[0] && this[0].parentNode ? this.first().prevAll().length : -1;
  39800. }
  39801. // Index in selector
  39802. if (typeof elem === "string") {
  39803. return indexOf.call(jQuery(elem), this[0]);
  39804. }
  39805. // Locate the position of the desired element
  39806. return indexOf.call(this,
  39807. // If it receives a jQuery object, the first element is used
  39808. elem.jquery ? elem[0] : elem);
  39809. },
  39810. add: function add(selector, context) {
  39811. return this.pushStack(jQuery.uniqueSort(jQuery.merge(this.get(), jQuery(selector, context))));
  39812. },
  39813. addBack: function addBack(selector) {
  39814. return this.add(selector == null ? this.prevObject : this.prevObject.filter(selector));
  39815. }
  39816. });
  39817. function sibling(cur, dir) {
  39818. while ((cur = cur[dir]) && cur.nodeType !== 1) {}
  39819. return cur;
  39820. }
  39821. jQuery.each({
  39822. parent: function parent(elem) {
  39823. var parent = elem.parentNode;
  39824. return parent && parent.nodeType !== 11 ? parent : null;
  39825. },
  39826. parents: function parents(elem) {
  39827. return dir(elem, "parentNode");
  39828. },
  39829. parentsUntil: function parentsUntil(elem, i, until) {
  39830. return dir(elem, "parentNode", until);
  39831. },
  39832. next: function next(elem) {
  39833. return sibling(elem, "nextSibling");
  39834. },
  39835. prev: function prev(elem) {
  39836. return sibling(elem, "previousSibling");
  39837. },
  39838. nextAll: function nextAll(elem) {
  39839. return dir(elem, "nextSibling");
  39840. },
  39841. prevAll: function prevAll(elem) {
  39842. return dir(elem, "previousSibling");
  39843. },
  39844. nextUntil: function nextUntil(elem, i, until) {
  39845. return dir(elem, "nextSibling", until);
  39846. },
  39847. prevUntil: function prevUntil(elem, i, until) {
  39848. return dir(elem, "previousSibling", until);
  39849. },
  39850. siblings: function siblings(elem) {
  39851. return _siblings((elem.parentNode || {}).firstChild, elem);
  39852. },
  39853. children: function children(elem) {
  39854. return _siblings(elem.firstChild);
  39855. },
  39856. contents: function contents(elem) {
  39857. if (nodeName(elem, "iframe")) {
  39858. return elem.contentDocument;
  39859. }
  39860. // Support: IE 9 - 11 only, iOS 7 only, Android Browser <=4.3 only
  39861. // Treat the template element as a regular one in browsers that
  39862. // don't support it.
  39863. if (nodeName(elem, "template")) {
  39864. elem = elem.content || elem;
  39865. }
  39866. return jQuery.merge([], elem.childNodes);
  39867. }
  39868. }, function (name, fn) {
  39869. jQuery.fn[name] = function (until, selector) {
  39870. var matched = jQuery.map(this, fn, until);
  39871. if (name.slice(-5) !== "Until") {
  39872. selector = until;
  39873. }
  39874. if (selector && typeof selector === "string") {
  39875. matched = jQuery.filter(selector, matched);
  39876. }
  39877. if (this.length > 1) {
  39878. // Remove duplicates
  39879. if (!guaranteedUnique[name]) {
  39880. jQuery.uniqueSort(matched);
  39881. }
  39882. // Reverse order for parents* and prev-derivatives
  39883. if (rparentsprev.test(name)) {
  39884. matched.reverse();
  39885. }
  39886. }
  39887. return this.pushStack(matched);
  39888. };
  39889. });
  39890. var rnothtmlwhite = /[^\x20\t\r\n\f]+/g;
  39891. // Convert String-formatted options into Object-formatted ones
  39892. function createOptions(options) {
  39893. var object = {};
  39894. jQuery.each(options.match(rnothtmlwhite) || [], function (_, flag) {
  39895. object[flag] = true;
  39896. });
  39897. return object;
  39898. }
  39899. /*
  39900. * Create a callback list using the following parameters:
  39901. *
  39902. * options: an optional list of space-separated options that will change how
  39903. * the callback list behaves or a more traditional option object
  39904. *
  39905. * By default a callback list will act like an event callback list and can be
  39906. * "fired" multiple times.
  39907. *
  39908. * Possible options:
  39909. *
  39910. * once: will ensure the callback list can only be fired once (like a Deferred)
  39911. *
  39912. * memory: will keep track of previous values and will call any callback added
  39913. * after the list has been fired right away with the latest "memorized"
  39914. * values (like a Deferred)
  39915. *
  39916. * unique: will ensure a callback can only be added once (no duplicate in the list)
  39917. *
  39918. * stopOnFalse: interrupt callings when a callback returns false
  39919. *
  39920. */
  39921. jQuery.Callbacks = function (options) {
  39922. // Convert options from String-formatted to Object-formatted if needed
  39923. // (we check in cache first)
  39924. options = typeof options === "string" ? createOptions(options) : jQuery.extend({}, options);
  39925. var // Flag to know if list is currently firing
  39926. firing,
  39927. // Last fire value for non-forgettable lists
  39928. memory,
  39929. // Flag to know if list was already fired
  39930. _fired,
  39931. // Flag to prevent firing
  39932. _locked,
  39933. // Actual callback list
  39934. list = [],
  39935. // Queue of execution data for repeatable lists
  39936. queue = [],
  39937. // Index of currently firing callback (modified by add/remove as needed)
  39938. firingIndex = -1,
  39939. // Fire callbacks
  39940. fire = function fire() {
  39941. // Enforce single-firing
  39942. _locked = _locked || options.once;
  39943. // Execute callbacks for all pending executions,
  39944. // respecting firingIndex overrides and runtime changes
  39945. _fired = firing = true;
  39946. for (; queue.length; firingIndex = -1) {
  39947. memory = queue.shift();
  39948. while (++firingIndex < list.length) {
  39949. // Run callback and check for early termination
  39950. if (list[firingIndex].apply(memory[0], memory[1]) === false && options.stopOnFalse) {
  39951. // Jump to end and forget the data so .add doesn't re-fire
  39952. firingIndex = list.length;
  39953. memory = false;
  39954. }
  39955. }
  39956. }
  39957. // Forget the data if we're done with it
  39958. if (!options.memory) {
  39959. memory = false;
  39960. }
  39961. firing = false;
  39962. // Clean up if we're done firing for good
  39963. if (_locked) {
  39964. // Keep an empty list if we have data for future add calls
  39965. if (memory) {
  39966. list = [];
  39967. // Otherwise, this object is spent
  39968. } else {
  39969. list = "";
  39970. }
  39971. }
  39972. },
  39973. // Actual Callbacks object
  39974. self = {
  39975. // Add a callback or a collection of callbacks to the list
  39976. add: function add() {
  39977. if (list) {
  39978. // If we have memory from a past run, we should fire after adding
  39979. if (memory && !firing) {
  39980. firingIndex = list.length - 1;
  39981. queue.push(memory);
  39982. }
  39983. (function add(args) {
  39984. jQuery.each(args, function (_, arg) {
  39985. if (isFunction(arg)) {
  39986. if (!options.unique || !self.has(arg)) {
  39987. list.push(arg);
  39988. }
  39989. } else if (arg && arg.length && toType(arg) !== "string") {
  39990. // Inspect recursively
  39991. add(arg);
  39992. }
  39993. });
  39994. })(arguments);
  39995. if (memory && !firing) {
  39996. fire();
  39997. }
  39998. }
  39999. return this;
  40000. },
  40001. // Remove a callback from the list
  40002. remove: function remove() {
  40003. jQuery.each(arguments, function (_, arg) {
  40004. var index;
  40005. while ((index = jQuery.inArray(arg, list, index)) > -1) {
  40006. list.splice(index, 1);
  40007. // Handle firing indexes
  40008. if (index <= firingIndex) {
  40009. firingIndex--;
  40010. }
  40011. }
  40012. });
  40013. return this;
  40014. },
  40015. // Check if a given callback is in the list.
  40016. // If no argument is given, return whether or not list has callbacks attached.
  40017. has: function has(fn) {
  40018. return fn ? jQuery.inArray(fn, list) > -1 : list.length > 0;
  40019. },
  40020. // Remove all callbacks from the list
  40021. empty: function empty() {
  40022. if (list) {
  40023. list = [];
  40024. }
  40025. return this;
  40026. },
  40027. // Disable .fire and .add
  40028. // Abort any current/pending executions
  40029. // Clear all callbacks and values
  40030. disable: function disable() {
  40031. _locked = queue = [];
  40032. list = memory = "";
  40033. return this;
  40034. },
  40035. disabled: function disabled() {
  40036. return !list;
  40037. },
  40038. // Disable .fire
  40039. // Also disable .add unless we have memory (since it would have no effect)
  40040. // Abort any pending executions
  40041. lock: function lock() {
  40042. _locked = queue = [];
  40043. if (!memory && !firing) {
  40044. list = memory = "";
  40045. }
  40046. return this;
  40047. },
  40048. locked: function locked() {
  40049. return !!_locked;
  40050. },
  40051. // Call all callbacks with the given context and arguments
  40052. fireWith: function fireWith(context, args) {
  40053. if (!_locked) {
  40054. args = args || [];
  40055. args = [context, args.slice ? args.slice() : args];
  40056. queue.push(args);
  40057. if (!firing) {
  40058. fire();
  40059. }
  40060. }
  40061. return this;
  40062. },
  40063. // Call all the callbacks with the given arguments
  40064. fire: function fire() {
  40065. self.fireWith(this, arguments);
  40066. return this;
  40067. },
  40068. // To know if the callbacks have already been called at least once
  40069. fired: function fired() {
  40070. return !!_fired;
  40071. }
  40072. };
  40073. return self;
  40074. };
  40075. function Identity(v) {
  40076. return v;
  40077. }
  40078. function Thrower(ex) {
  40079. throw ex;
  40080. }
  40081. function adoptValue(value, resolve, reject, noValue) {
  40082. var method;
  40083. try {
  40084. // Check for promise aspect first to privilege synchronous behavior
  40085. if (value && isFunction(method = value.promise)) {
  40086. method.call(value).done(resolve).fail(reject);
  40087. // Other thenables
  40088. } else if (value && isFunction(method = value.then)) {
  40089. method.call(value, resolve, reject);
  40090. // Other non-thenables
  40091. } else {
  40092. // Control `resolve` arguments by letting Array#slice cast boolean `noValue` to integer:
  40093. // * false: [ value ].slice( 0 ) => resolve( value )
  40094. // * true: [ value ].slice( 1 ) => resolve()
  40095. resolve.apply(undefined, [value].slice(noValue));
  40096. }
  40097. // For Promises/A+, convert exceptions into rejections
  40098. // Since jQuery.when doesn't unwrap thenables, we can skip the extra checks appearing in
  40099. // Deferred#then to conditionally suppress rejection.
  40100. } catch (value) {
  40101. // Support: Android 4.0 only
  40102. // Strict mode functions invoked without .call/.apply get global-object context
  40103. reject.apply(undefined, [value]);
  40104. }
  40105. }
  40106. jQuery.extend({
  40107. Deferred: function Deferred(func) {
  40108. var tuples = [
  40109. // action, add listener, callbacks,
  40110. // ... .then handlers, argument index, [final state]
  40111. ["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"]],
  40112. _state = "pending",
  40113. _promise = {
  40114. state: function state() {
  40115. return _state;
  40116. },
  40117. always: function always() {
  40118. deferred.done(arguments).fail(arguments);
  40119. return this;
  40120. },
  40121. "catch": function _catch(fn) {
  40122. return _promise.then(null, fn);
  40123. },
  40124. // Keep pipe for back-compat
  40125. pipe: function pipe() /* fnDone, fnFail, fnProgress */{
  40126. var fns = arguments;
  40127. return jQuery.Deferred(function (newDefer) {
  40128. jQuery.each(tuples, function (i, tuple) {
  40129. // Map tuples (progress, done, fail) to arguments (done, fail, progress)
  40130. var fn = isFunction(fns[tuple[4]]) && fns[tuple[4]];
  40131. // deferred.progress(function() { bind to newDefer or newDefer.notify })
  40132. // deferred.done(function() { bind to newDefer or newDefer.resolve })
  40133. // deferred.fail(function() { bind to newDefer or newDefer.reject })
  40134. deferred[tuple[1]](function () {
  40135. var returned = fn && fn.apply(this, arguments);
  40136. if (returned && isFunction(returned.promise)) {
  40137. returned.promise().progress(newDefer.notify).done(newDefer.resolve).fail(newDefer.reject);
  40138. } else {
  40139. newDefer[tuple[0] + "With"](this, fn ? [returned] : arguments);
  40140. }
  40141. });
  40142. });
  40143. fns = null;
  40144. }).promise();
  40145. },
  40146. then: function then(onFulfilled, onRejected, onProgress) {
  40147. var maxDepth = 0;
  40148. function resolve(depth, deferred, handler, special) {
  40149. return function () {
  40150. var that = this,
  40151. args = arguments,
  40152. mightThrow = function mightThrow() {
  40153. var returned, then;
  40154. // Support: Promises/A+ section 2.3.3.3.3
  40155. // https://promisesaplus.com/#point-59
  40156. // Ignore double-resolution attempts
  40157. if (depth < maxDepth) {
  40158. return;
  40159. }
  40160. returned = handler.apply(that, args);
  40161. // Support: Promises/A+ section 2.3.1
  40162. // https://promisesaplus.com/#point-48
  40163. if (returned === deferred.promise()) {
  40164. throw new TypeError("Thenable self-resolution");
  40165. }
  40166. // Support: Promises/A+ sections 2.3.3.1, 3.5
  40167. // https://promisesaplus.com/#point-54
  40168. // https://promisesaplus.com/#point-75
  40169. // Retrieve `then` only once
  40170. then = returned && (
  40171. // Support: Promises/A+ section 2.3.4
  40172. // https://promisesaplus.com/#point-64
  40173. // Only check objects and functions for thenability
  40174. (typeof returned === "undefined" ? "undefined" : _typeof(returned)) === "object" || typeof returned === "function") && returned.then;
  40175. // Handle a returned thenable
  40176. if (isFunction(then)) {
  40177. // Special processors (notify) just wait for resolution
  40178. if (special) {
  40179. then.call(returned, resolve(maxDepth, deferred, Identity, special), resolve(maxDepth, deferred, Thrower, special));
  40180. // Normal processors (resolve) also hook into progress
  40181. } else {
  40182. // ...and disregard older resolution values
  40183. maxDepth++;
  40184. then.call(returned, resolve(maxDepth, deferred, Identity, special), resolve(maxDepth, deferred, Thrower, special), resolve(maxDepth, deferred, Identity, deferred.notifyWith));
  40185. }
  40186. // Handle all other returned values
  40187. } else {
  40188. // Only substitute handlers pass on context
  40189. // and multiple values (non-spec behavior)
  40190. if (handler !== Identity) {
  40191. that = undefined;
  40192. args = [returned];
  40193. }
  40194. // Process the value(s)
  40195. // Default process is resolve
  40196. (special || deferred.resolveWith)(that, args);
  40197. }
  40198. },
  40199. // Only normal processors (resolve) catch and reject exceptions
  40200. process = special ? mightThrow : function () {
  40201. try {
  40202. mightThrow();
  40203. } catch (e) {
  40204. if (jQuery.Deferred.exceptionHook) {
  40205. jQuery.Deferred.exceptionHook(e, process.stackTrace);
  40206. }
  40207. // Support: Promises/A+ section 2.3.3.3.4.1
  40208. // https://promisesaplus.com/#point-61
  40209. // Ignore post-resolution exceptions
  40210. if (depth + 1 >= maxDepth) {
  40211. // Only substitute handlers pass on context
  40212. // and multiple values (non-spec behavior)
  40213. if (handler !== Thrower) {
  40214. that = undefined;
  40215. args = [e];
  40216. }
  40217. deferred.rejectWith(that, args);
  40218. }
  40219. }
  40220. };
  40221. // Support: Promises/A+ section 2.3.3.3.1
  40222. // https://promisesaplus.com/#point-57
  40223. // Re-resolve promises immediately to dodge false rejection from
  40224. // subsequent errors
  40225. if (depth) {
  40226. process();
  40227. } else {
  40228. // Call an optional hook to record the stack, in case of exception
  40229. // since it's otherwise lost when execution goes async
  40230. if (jQuery.Deferred.getStackHook) {
  40231. process.stackTrace = jQuery.Deferred.getStackHook();
  40232. }
  40233. window.setTimeout(process);
  40234. }
  40235. };
  40236. }
  40237. return jQuery.Deferred(function (newDefer) {
  40238. // progress_handlers.add( ... )
  40239. tuples[0][3].add(resolve(0, newDefer, isFunction(onProgress) ? onProgress : Identity, newDefer.notifyWith));
  40240. // fulfilled_handlers.add( ... )
  40241. tuples[1][3].add(resolve(0, newDefer, isFunction(onFulfilled) ? onFulfilled : Identity));
  40242. // rejected_handlers.add( ... )
  40243. tuples[2][3].add(resolve(0, newDefer, isFunction(onRejected) ? onRejected : Thrower));
  40244. }).promise();
  40245. },
  40246. // Get a promise for this deferred
  40247. // If obj is provided, the promise aspect is added to the object
  40248. promise: function promise(obj) {
  40249. return obj != null ? jQuery.extend(obj, _promise) : _promise;
  40250. }
  40251. },
  40252. deferred = {};
  40253. // Add list-specific methods
  40254. jQuery.each(tuples, function (i, tuple) {
  40255. var list = tuple[2],
  40256. stateString = tuple[5];
  40257. // promise.progress = list.add
  40258. // promise.done = list.add
  40259. // promise.fail = list.add
  40260. _promise[tuple[1]] = list.add;
  40261. // Handle state
  40262. if (stateString) {
  40263. list.add(function () {
  40264. // state = "resolved" (i.e., fulfilled)
  40265. // state = "rejected"
  40266. _state = stateString;
  40267. },
  40268. // rejected_callbacks.disable
  40269. // fulfilled_callbacks.disable
  40270. tuples[3 - i][2].disable,
  40271. // rejected_handlers.disable
  40272. // fulfilled_handlers.disable
  40273. tuples[3 - i][3].disable,
  40274. // progress_callbacks.lock
  40275. tuples[0][2].lock,
  40276. // progress_handlers.lock
  40277. tuples[0][3].lock);
  40278. }
  40279. // progress_handlers.fire
  40280. // fulfilled_handlers.fire
  40281. // rejected_handlers.fire
  40282. list.add(tuple[3].fire);
  40283. // deferred.notify = function() { deferred.notifyWith(...) }
  40284. // deferred.resolve = function() { deferred.resolveWith(...) }
  40285. // deferred.reject = function() { deferred.rejectWith(...) }
  40286. deferred[tuple[0]] = function () {
  40287. deferred[tuple[0] + "With"](this === deferred ? undefined : this, arguments);
  40288. return this;
  40289. };
  40290. // deferred.notifyWith = list.fireWith
  40291. // deferred.resolveWith = list.fireWith
  40292. // deferred.rejectWith = list.fireWith
  40293. deferred[tuple[0] + "With"] = list.fireWith;
  40294. });
  40295. // Make the deferred a promise
  40296. _promise.promise(deferred);
  40297. // Call given func if any
  40298. if (func) {
  40299. func.call(deferred, deferred);
  40300. }
  40301. // All done!
  40302. return deferred;
  40303. },
  40304. // Deferred helper
  40305. when: function when(singleValue) {
  40306. var
  40307. // count of uncompleted subordinates
  40308. remaining = arguments.length,
  40309. // count of unprocessed arguments
  40310. i = remaining,
  40311. // subordinate fulfillment data
  40312. resolveContexts = Array(i),
  40313. resolveValues = _slice.call(arguments),
  40314. // the master Deferred
  40315. master = jQuery.Deferred(),
  40316. // subordinate callback factory
  40317. updateFunc = function updateFunc(i) {
  40318. return function (value) {
  40319. resolveContexts[i] = this;
  40320. resolveValues[i] = arguments.length > 1 ? _slice.call(arguments) : value;
  40321. if (! --remaining) {
  40322. master.resolveWith(resolveContexts, resolveValues);
  40323. }
  40324. };
  40325. };
  40326. // Single- and empty arguments are adopted like Promise.resolve
  40327. if (remaining <= 1) {
  40328. adoptValue(singleValue, master.done(updateFunc(i)).resolve, master.reject, !remaining);
  40329. // Use .then() to unwrap secondary thenables (cf. gh-3000)
  40330. if (master.state() === "pending" || isFunction(resolveValues[i] && resolveValues[i].then)) {
  40331. return master.then();
  40332. }
  40333. }
  40334. // Multiple arguments are aggregated like Promise.all array elements
  40335. while (i--) {
  40336. adoptValue(resolveValues[i], updateFunc(i), master.reject);
  40337. }
  40338. return master.promise();
  40339. }
  40340. });
  40341. // These usually indicate a programmer mistake during development,
  40342. // warn about them ASAP rather than swallowing them by default.
  40343. var rerrorNames = /^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/;
  40344. jQuery.Deferred.exceptionHook = function (error, stack) {
  40345. // Support: IE 8 - 9 only
  40346. // Console exists when dev tools are open, which can happen at any time
  40347. if (window.console && window.console.warn && error && rerrorNames.test(error.name)) {
  40348. window.console.warn("jQuery.Deferred exception: " + error.message, error.stack, stack);
  40349. }
  40350. };
  40351. jQuery.readyException = function (error) {
  40352. window.setTimeout(function () {
  40353. throw error;
  40354. });
  40355. };
  40356. // The deferred used on DOM ready
  40357. var readyList = jQuery.Deferred();
  40358. jQuery.fn.ready = function (fn) {
  40359. readyList.then(fn)
  40360. // Wrap jQuery.readyException in a function so that the lookup
  40361. // happens at the time of error handling instead of callback
  40362. // registration.
  40363. .catch(function (error) {
  40364. jQuery.readyException(error);
  40365. });
  40366. return this;
  40367. };
  40368. jQuery.extend({
  40369. // Is the DOM ready to be used? Set to true once it occurs.
  40370. isReady: false,
  40371. // A counter to track how many items to wait for before
  40372. // the ready event fires. See #6781
  40373. readyWait: 1,
  40374. // Handle when the DOM is ready
  40375. ready: function ready(wait) {
  40376. // Abort if there are pending holds or we're already ready
  40377. if (wait === true ? --jQuery.readyWait : jQuery.isReady) {
  40378. return;
  40379. }
  40380. // Remember that the DOM is ready
  40381. jQuery.isReady = true;
  40382. // If a normal DOM Ready event fired, decrement, and wait if need be
  40383. if (wait !== true && --jQuery.readyWait > 0) {
  40384. return;
  40385. }
  40386. // If there are functions bound, to execute
  40387. readyList.resolveWith(document, [jQuery]);
  40388. }
  40389. });
  40390. jQuery.ready.then = readyList.then;
  40391. // The ready event handler and self cleanup method
  40392. function completed() {
  40393. document.removeEventListener("DOMContentLoaded", completed);
  40394. window.removeEventListener("load", completed);
  40395. jQuery.ready();
  40396. }
  40397. // Catch cases where $(document).ready() is called
  40398. // after the browser event has already occurred.
  40399. // Support: IE <=9 - 10 only
  40400. // Older IE sometimes signals "interactive" too soon
  40401. if (document.readyState === "complete" || document.readyState !== "loading" && !document.documentElement.doScroll) {
  40402. // Handle it asynchronously to allow scripts the opportunity to delay ready
  40403. window.setTimeout(jQuery.ready);
  40404. } else {
  40405. // Use the handy event callback
  40406. document.addEventListener("DOMContentLoaded", completed);
  40407. // A fallback to window.onload, that will always work
  40408. window.addEventListener("load", completed);
  40409. }
  40410. // Multifunctional method to get and set values of a collection
  40411. // The value/s can optionally be executed if it's a function
  40412. var access = function access(elems, fn, key, value, chainable, emptyGet, raw) {
  40413. var i = 0,
  40414. len = elems.length,
  40415. bulk = key == null;
  40416. // Sets many values
  40417. if (toType(key) === "object") {
  40418. chainable = true;
  40419. for (i in key) {
  40420. access(elems, fn, i, key[i], true, emptyGet, raw);
  40421. }
  40422. // Sets one value
  40423. } else if (value !== undefined) {
  40424. chainable = true;
  40425. if (!isFunction(value)) {
  40426. raw = true;
  40427. }
  40428. if (bulk) {
  40429. // Bulk operations run against the entire set
  40430. if (raw) {
  40431. fn.call(elems, value);
  40432. fn = null;
  40433. // ...except when executing function values
  40434. } else {
  40435. bulk = fn;
  40436. fn = function fn(elem, key, value) {
  40437. return bulk.call(jQuery(elem), value);
  40438. };
  40439. }
  40440. }
  40441. if (fn) {
  40442. for (; i < len; i++) {
  40443. fn(elems[i], key, raw ? value : value.call(elems[i], i, fn(elems[i], key)));
  40444. }
  40445. }
  40446. }
  40447. if (chainable) {
  40448. return elems;
  40449. }
  40450. // Gets
  40451. if (bulk) {
  40452. return fn.call(elems);
  40453. }
  40454. return len ? fn(elems[0], key) : emptyGet;
  40455. };
  40456. // Matches dashed string for camelizing
  40457. var rmsPrefix = /^-ms-/,
  40458. rdashAlpha = /-([a-z])/g;
  40459. // Used by camelCase as callback to replace()
  40460. function fcamelCase(all, letter) {
  40461. return letter.toUpperCase();
  40462. }
  40463. // Convert dashed to camelCase; used by the css and data modules
  40464. // Support: IE <=9 - 11, Edge 12 - 15
  40465. // Microsoft forgot to hump their vendor prefix (#9572)
  40466. function camelCase(string) {
  40467. return string.replace(rmsPrefix, "ms-").replace(rdashAlpha, fcamelCase);
  40468. }
  40469. var acceptData = function acceptData(owner) {
  40470. // Accepts only:
  40471. // - Node
  40472. // - Node.ELEMENT_NODE
  40473. // - Node.DOCUMENT_NODE
  40474. // - Object
  40475. // - Any
  40476. return owner.nodeType === 1 || owner.nodeType === 9 || !+owner.nodeType;
  40477. };
  40478. function Data() {
  40479. this.expando = jQuery.expando + Data.uid++;
  40480. }
  40481. Data.uid = 1;
  40482. Data.prototype = {
  40483. cache: function cache(owner) {
  40484. // Check if the owner object already has a cache
  40485. var value = owner[this.expando];
  40486. // If not, create one
  40487. if (!value) {
  40488. value = {};
  40489. // We can accept data for non-element nodes in modern browsers,
  40490. // but we should not, see #8335.
  40491. // Always return an empty object.
  40492. if (acceptData(owner)) {
  40493. // If it is a node unlikely to be stringify-ed or looped over
  40494. // use plain assignment
  40495. if (owner.nodeType) {
  40496. owner[this.expando] = value;
  40497. // Otherwise secure it in a non-enumerable property
  40498. // configurable must be true to allow the property to be
  40499. // deleted when data is removed
  40500. } else {
  40501. Object.defineProperty(owner, this.expando, {
  40502. value: value,
  40503. configurable: true
  40504. });
  40505. }
  40506. }
  40507. }
  40508. return value;
  40509. },
  40510. set: function set(owner, data, value) {
  40511. var prop,
  40512. cache = this.cache(owner);
  40513. // Handle: [ owner, key, value ] args
  40514. // Always use camelCase key (gh-2257)
  40515. if (typeof data === "string") {
  40516. cache[camelCase(data)] = value;
  40517. // Handle: [ owner, { properties } ] args
  40518. } else {
  40519. // Copy the properties one-by-one to the cache object
  40520. for (prop in data) {
  40521. cache[camelCase(prop)] = data[prop];
  40522. }
  40523. }
  40524. return cache;
  40525. },
  40526. get: function get(owner, key) {
  40527. return key === undefined ? this.cache(owner) :
  40528. // Always use camelCase key (gh-2257)
  40529. owner[this.expando] && owner[this.expando][camelCase(key)];
  40530. },
  40531. access: function access(owner, key, value) {
  40532. // In cases where either:
  40533. //
  40534. // 1. No key was specified
  40535. // 2. A string key was specified, but no value provided
  40536. //
  40537. // Take the "read" path and allow the get method to determine
  40538. // which value to return, respectively either:
  40539. //
  40540. // 1. The entire cache object
  40541. // 2. The data stored at the key
  40542. //
  40543. if (key === undefined || key && typeof key === "string" && value === undefined) {
  40544. return this.get(owner, key);
  40545. }
  40546. // When the key is not a string, or both a key and value
  40547. // are specified, set or extend (existing objects) with either:
  40548. //
  40549. // 1. An object of properties
  40550. // 2. A key and value
  40551. //
  40552. this.set(owner, key, value);
  40553. // Since the "set" path can have two possible entry points
  40554. // return the expected data based on which path was taken[*]
  40555. return value !== undefined ? value : key;
  40556. },
  40557. remove: function remove(owner, key) {
  40558. var i,
  40559. cache = owner[this.expando];
  40560. if (cache === undefined) {
  40561. return;
  40562. }
  40563. if (key !== undefined) {
  40564. // Support array or space separated string of keys
  40565. if (Array.isArray(key)) {
  40566. // If key is an array of keys...
  40567. // We always set camelCase keys, so remove that.
  40568. key = key.map(camelCase);
  40569. } else {
  40570. key = camelCase(key);
  40571. // If a key with the spaces exists, use it.
  40572. // Otherwise, create an array by matching non-whitespace
  40573. key = key in cache ? [key] : key.match(rnothtmlwhite) || [];
  40574. }
  40575. i = key.length;
  40576. while (i--) {
  40577. delete cache[key[i]];
  40578. }
  40579. }
  40580. // Remove the expando if there's no more data
  40581. if (key === undefined || jQuery.isEmptyObject(cache)) {
  40582. // Support: Chrome <=35 - 45
  40583. // Webkit & Blink performance suffers when deleting properties
  40584. // from DOM nodes, so set to undefined instead
  40585. // https://bugs.chromium.org/p/chromium/issues/detail?id=378607 (bug restricted)
  40586. if (owner.nodeType) {
  40587. owner[this.expando] = undefined;
  40588. } else {
  40589. delete owner[this.expando];
  40590. }
  40591. }
  40592. },
  40593. hasData: function hasData(owner) {
  40594. var cache = owner[this.expando];
  40595. return cache !== undefined && !jQuery.isEmptyObject(cache);
  40596. }
  40597. };
  40598. var dataPriv = new Data();
  40599. var dataUser = new Data();
  40600. // Implementation Summary
  40601. //
  40602. // 1. Enforce API surface and semantic compatibility with 1.9.x branch
  40603. // 2. Improve the module's maintainability by reducing the storage
  40604. // paths to a single mechanism.
  40605. // 3. Use the same single mechanism to support "private" and "user" data.
  40606. // 4. _Never_ expose "private" data to user code (TODO: Drop _data, _removeData)
  40607. // 5. Avoid exposing implementation details on user objects (eg. expando properties)
  40608. // 6. Provide a clear path for implementation upgrade to WeakMap in 2014
  40609. var rbrace = /^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,
  40610. rmultiDash = /[A-Z]/g;
  40611. function getData(data) {
  40612. if (data === "true") {
  40613. return true;
  40614. }
  40615. if (data === "false") {
  40616. return false;
  40617. }
  40618. if (data === "null") {
  40619. return null;
  40620. }
  40621. // Only convert to a number if it doesn't change the string
  40622. if (data === +data + "") {
  40623. return +data;
  40624. }
  40625. if (rbrace.test(data)) {
  40626. return JSON.parse(data);
  40627. }
  40628. return data;
  40629. }
  40630. function dataAttr(elem, key, data) {
  40631. var name;
  40632. // If nothing was found internally, try to fetch any
  40633. // data from the HTML5 data-* attribute
  40634. if (data === undefined && elem.nodeType === 1) {
  40635. name = "data-" + key.replace(rmultiDash, "-$&").toLowerCase();
  40636. data = elem.getAttribute(name);
  40637. if (typeof data === "string") {
  40638. try {
  40639. data = getData(data);
  40640. } catch (e) {}
  40641. // Make sure we set the data so it isn't changed later
  40642. dataUser.set(elem, key, data);
  40643. } else {
  40644. data = undefined;
  40645. }
  40646. }
  40647. return data;
  40648. }
  40649. jQuery.extend({
  40650. hasData: function hasData(elem) {
  40651. return dataUser.hasData(elem) || dataPriv.hasData(elem);
  40652. },
  40653. data: function data(elem, name, _data) {
  40654. return dataUser.access(elem, name, _data);
  40655. },
  40656. removeData: function removeData(elem, name) {
  40657. dataUser.remove(elem, name);
  40658. },
  40659. // TODO: Now that all calls to _data and _removeData have been replaced
  40660. // with direct calls to dataPriv methods, these can be deprecated.
  40661. _data: function _data(elem, name, data) {
  40662. return dataPriv.access(elem, name, data);
  40663. },
  40664. _removeData: function _removeData(elem, name) {
  40665. dataPriv.remove(elem, name);
  40666. }
  40667. });
  40668. jQuery.fn.extend({
  40669. data: function data(key, value) {
  40670. var i,
  40671. name,
  40672. data,
  40673. elem = this[0],
  40674. attrs = elem && elem.attributes;
  40675. // Gets all values
  40676. if (key === undefined) {
  40677. if (this.length) {
  40678. data = dataUser.get(elem);
  40679. if (elem.nodeType === 1 && !dataPriv.get(elem, "hasDataAttrs")) {
  40680. i = attrs.length;
  40681. while (i--) {
  40682. // Support: IE 11 only
  40683. // The attrs elements can be null (#14894)
  40684. if (attrs[i]) {
  40685. name = attrs[i].name;
  40686. if (name.indexOf("data-") === 0) {
  40687. name = camelCase(name.slice(5));
  40688. dataAttr(elem, name, data[name]);
  40689. }
  40690. }
  40691. }
  40692. dataPriv.set(elem, "hasDataAttrs", true);
  40693. }
  40694. }
  40695. return data;
  40696. }
  40697. // Sets multiple values
  40698. if ((typeof key === "undefined" ? "undefined" : _typeof(key)) === "object") {
  40699. return this.each(function () {
  40700. dataUser.set(this, key);
  40701. });
  40702. }
  40703. return access(this, function (value) {
  40704. var data;
  40705. // The calling jQuery object (element matches) is not empty
  40706. // (and therefore has an element appears at this[ 0 ]) and the
  40707. // `value` parameter was not undefined. An empty jQuery object
  40708. // will result in `undefined` for elem = this[ 0 ] which will
  40709. // throw an exception if an attempt to read a data cache is made.
  40710. if (elem && value === undefined) {
  40711. // Attempt to get data from the cache
  40712. // The key will always be camelCased in Data
  40713. data = dataUser.get(elem, key);
  40714. if (data !== undefined) {
  40715. return data;
  40716. }
  40717. // Attempt to "discover" the data in
  40718. // HTML5 custom data-* attrs
  40719. data = dataAttr(elem, key);
  40720. if (data !== undefined) {
  40721. return data;
  40722. }
  40723. // We tried really hard, but the data doesn't exist.
  40724. return;
  40725. }
  40726. // Set the data...
  40727. this.each(function () {
  40728. // We always store the camelCased key
  40729. dataUser.set(this, key, value);
  40730. });
  40731. }, null, value, arguments.length > 1, null, true);
  40732. },
  40733. removeData: function removeData(key) {
  40734. return this.each(function () {
  40735. dataUser.remove(this, key);
  40736. });
  40737. }
  40738. });
  40739. jQuery.extend({
  40740. queue: function queue(elem, type, data) {
  40741. var queue;
  40742. if (elem) {
  40743. type = (type || "fx") + "queue";
  40744. queue = dataPriv.get(elem, type);
  40745. // Speed up dequeue by getting out quickly if this is just a lookup
  40746. if (data) {
  40747. if (!queue || Array.isArray(data)) {
  40748. queue = dataPriv.access(elem, type, jQuery.makeArray(data));
  40749. } else {
  40750. queue.push(data);
  40751. }
  40752. }
  40753. return queue || [];
  40754. }
  40755. },
  40756. dequeue: function dequeue(elem, type) {
  40757. type = type || "fx";
  40758. var queue = jQuery.queue(elem, type),
  40759. startLength = queue.length,
  40760. fn = queue.shift(),
  40761. hooks = jQuery._queueHooks(elem, type),
  40762. next = function next() {
  40763. jQuery.dequeue(elem, type);
  40764. };
  40765. // If the fx queue is dequeued, always remove the progress sentinel
  40766. if (fn === "inprogress") {
  40767. fn = queue.shift();
  40768. startLength--;
  40769. }
  40770. if (fn) {
  40771. // Add a progress sentinel to prevent the fx queue from being
  40772. // automatically dequeued
  40773. if (type === "fx") {
  40774. queue.unshift("inprogress");
  40775. }
  40776. // Clear up the last queue stop function
  40777. delete hooks.stop;
  40778. fn.call(elem, next, hooks);
  40779. }
  40780. if (!startLength && hooks) {
  40781. hooks.empty.fire();
  40782. }
  40783. },
  40784. // Not public - generate a queueHooks object, or return the current one
  40785. _queueHooks: function _queueHooks(elem, type) {
  40786. var key = type + "queueHooks";
  40787. return dataPriv.get(elem, key) || dataPriv.access(elem, key, {
  40788. empty: jQuery.Callbacks("once memory").add(function () {
  40789. dataPriv.remove(elem, [type + "queue", key]);
  40790. })
  40791. });
  40792. }
  40793. });
  40794. jQuery.fn.extend({
  40795. queue: function queue(type, data) {
  40796. var setter = 2;
  40797. if (typeof type !== "string") {
  40798. data = type;
  40799. type = "fx";
  40800. setter--;
  40801. }
  40802. if (arguments.length < setter) {
  40803. return jQuery.queue(this[0], type);
  40804. }
  40805. return data === undefined ? this : this.each(function () {
  40806. var queue = jQuery.queue(this, type, data);
  40807. // Ensure a hooks for this queue
  40808. jQuery._queueHooks(this, type);
  40809. if (type === "fx" && queue[0] !== "inprogress") {
  40810. jQuery.dequeue(this, type);
  40811. }
  40812. });
  40813. },
  40814. dequeue: function dequeue(type) {
  40815. return this.each(function () {
  40816. jQuery.dequeue(this, type);
  40817. });
  40818. },
  40819. clearQueue: function clearQueue(type) {
  40820. return this.queue(type || "fx", []);
  40821. },
  40822. // Get a promise resolved when queues of a certain type
  40823. // are emptied (fx is the type by default)
  40824. promise: function promise(type, obj) {
  40825. var tmp,
  40826. count = 1,
  40827. defer = jQuery.Deferred(),
  40828. elements = this,
  40829. i = this.length,
  40830. resolve = function resolve() {
  40831. if (! --count) {
  40832. defer.resolveWith(elements, [elements]);
  40833. }
  40834. };
  40835. if (typeof type !== "string") {
  40836. obj = type;
  40837. type = undefined;
  40838. }
  40839. type = type || "fx";
  40840. while (i--) {
  40841. tmp = dataPriv.get(elements[i], type + "queueHooks");
  40842. if (tmp && tmp.empty) {
  40843. count++;
  40844. tmp.empty.add(resolve);
  40845. }
  40846. }
  40847. resolve();
  40848. return defer.promise(obj);
  40849. }
  40850. });
  40851. var pnum = /[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source;
  40852. var rcssNum = new RegExp("^(?:([+-])=|)(" + pnum + ")([a-z%]*)$", "i");
  40853. var cssExpand = ["Top", "Right", "Bottom", "Left"];
  40854. var isHiddenWithinTree = function isHiddenWithinTree(elem, el) {
  40855. // isHiddenWithinTree might be called from jQuery#filter function;
  40856. // in that case, element will be second argument
  40857. elem = el || elem;
  40858. // Inline style trumps all
  40859. return elem.style.display === "none" || elem.style.display === "" &&
  40860. // Otherwise, check computed style
  40861. // Support: Firefox <=43 - 45
  40862. // Disconnected elements can have computed display: none, so first confirm that elem is
  40863. // in the document.
  40864. jQuery.contains(elem.ownerDocument, elem) && jQuery.css(elem, "display") === "none";
  40865. };
  40866. var swap = function swap(elem, options, callback, args) {
  40867. var ret,
  40868. name,
  40869. old = {};
  40870. // Remember the old values, and insert the new ones
  40871. for (name in options) {
  40872. old[name] = elem.style[name];
  40873. elem.style[name] = options[name];
  40874. }
  40875. ret = callback.apply(elem, args || []);
  40876. // Revert the old values
  40877. for (name in options) {
  40878. elem.style[name] = old[name];
  40879. }
  40880. return ret;
  40881. };
  40882. function adjustCSS(elem, prop, valueParts, tween) {
  40883. var adjusted,
  40884. scale,
  40885. maxIterations = 20,
  40886. currentValue = tween ? function () {
  40887. return tween.cur();
  40888. } : function () {
  40889. return jQuery.css(elem, prop, "");
  40890. },
  40891. initial = currentValue(),
  40892. unit = valueParts && valueParts[3] || (jQuery.cssNumber[prop] ? "" : "px"),
  40893. // Starting value computation is required for potential unit mismatches
  40894. initialInUnit = (jQuery.cssNumber[prop] || unit !== "px" && +initial) && rcssNum.exec(jQuery.css(elem, prop));
  40895. if (initialInUnit && initialInUnit[3] !== unit) {
  40896. // Support: Firefox <=54
  40897. // Halve the iteration target value to prevent interference from CSS upper bounds (gh-2144)
  40898. initial = initial / 2;
  40899. // Trust units reported by jQuery.css
  40900. unit = unit || initialInUnit[3];
  40901. // Iteratively approximate from a nonzero starting point
  40902. initialInUnit = +initial || 1;
  40903. while (maxIterations--) {
  40904. // Evaluate and update our best guess (doubling guesses that zero out).
  40905. // Finish if the scale equals or crosses 1 (making the old*new product non-positive).
  40906. jQuery.style(elem, prop, initialInUnit + unit);
  40907. if ((1 - scale) * (1 - (scale = currentValue() / initial || 0.5)) <= 0) {
  40908. maxIterations = 0;
  40909. }
  40910. initialInUnit = initialInUnit / scale;
  40911. }
  40912. initialInUnit = initialInUnit * 2;
  40913. jQuery.style(elem, prop, initialInUnit + unit);
  40914. // Make sure we update the tween properties later on
  40915. valueParts = valueParts || [];
  40916. }
  40917. if (valueParts) {
  40918. initialInUnit = +initialInUnit || +initial || 0;
  40919. // Apply relative offset (+=/-=) if specified
  40920. adjusted = valueParts[1] ? initialInUnit + (valueParts[1] + 1) * valueParts[2] : +valueParts[2];
  40921. if (tween) {
  40922. tween.unit = unit;
  40923. tween.start = initialInUnit;
  40924. tween.end = adjusted;
  40925. }
  40926. }
  40927. return adjusted;
  40928. }
  40929. var defaultDisplayMap = {};
  40930. function getDefaultDisplay(elem) {
  40931. var temp,
  40932. doc = elem.ownerDocument,
  40933. nodeName = elem.nodeName,
  40934. display = defaultDisplayMap[nodeName];
  40935. if (display) {
  40936. return display;
  40937. }
  40938. temp = doc.body.appendChild(doc.createElement(nodeName));
  40939. display = jQuery.css(temp, "display");
  40940. temp.parentNode.removeChild(temp);
  40941. if (display === "none") {
  40942. display = "block";
  40943. }
  40944. defaultDisplayMap[nodeName] = display;
  40945. return display;
  40946. }
  40947. function showHide(elements, show) {
  40948. var display,
  40949. elem,
  40950. values = [],
  40951. index = 0,
  40952. length = elements.length;
  40953. // Determine new display value for elements that need to change
  40954. for (; index < length; index++) {
  40955. elem = elements[index];
  40956. if (!elem.style) {
  40957. continue;
  40958. }
  40959. display = elem.style.display;
  40960. if (show) {
  40961. // Since we force visibility upon cascade-hidden elements, an immediate (and slow)
  40962. // check is required in this first loop unless we have a nonempty display value (either
  40963. // inline or about-to-be-restored)
  40964. if (display === "none") {
  40965. values[index] = dataPriv.get(elem, "display") || null;
  40966. if (!values[index]) {
  40967. elem.style.display = "";
  40968. }
  40969. }
  40970. if (elem.style.display === "" && isHiddenWithinTree(elem)) {
  40971. values[index] = getDefaultDisplay(elem);
  40972. }
  40973. } else {
  40974. if (display !== "none") {
  40975. values[index] = "none";
  40976. // Remember what we're overwriting
  40977. dataPriv.set(elem, "display", display);
  40978. }
  40979. }
  40980. }
  40981. // Set the display of the elements in a second loop to avoid constant reflow
  40982. for (index = 0; index < length; index++) {
  40983. if (values[index] != null) {
  40984. elements[index].style.display = values[index];
  40985. }
  40986. }
  40987. return elements;
  40988. }
  40989. jQuery.fn.extend({
  40990. show: function show() {
  40991. return showHide(this, true);
  40992. },
  40993. hide: function hide() {
  40994. return showHide(this);
  40995. },
  40996. toggle: function toggle(state) {
  40997. if (typeof state === "boolean") {
  40998. return state ? this.show() : this.hide();
  40999. }
  41000. return this.each(function () {
  41001. if (isHiddenWithinTree(this)) {
  41002. jQuery(this).show();
  41003. } else {
  41004. jQuery(this).hide();
  41005. }
  41006. });
  41007. }
  41008. });
  41009. var rcheckableType = /^(?:checkbox|radio)$/i;
  41010. var rtagName = /<([a-z][^\/\0>\x20\t\r\n\f]+)/i;
  41011. var rscriptType = /^$|^module$|\/(?:java|ecma)script/i;
  41012. // We have to close these tags to support XHTML (#13200)
  41013. var wrapMap = {
  41014. // Support: IE <=9 only
  41015. option: [1, "<select multiple='multiple'>", "</select>"],
  41016. // XHTML parsers do not magically insert elements in the
  41017. // same way that tag soup parsers do. So we cannot shorten
  41018. // this by omitting <tbody> or other required elements.
  41019. thead: [1, "<table>", "</table>"],
  41020. col: [2, "<table><colgroup>", "</colgroup></table>"],
  41021. tr: [2, "<table><tbody>", "</tbody></table>"],
  41022. td: [3, "<table><tbody><tr>", "</tr></tbody></table>"],
  41023. _default: [0, "", ""]
  41024. };
  41025. // Support: IE <=9 only
  41026. wrapMap.optgroup = wrapMap.option;
  41027. wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;
  41028. wrapMap.th = wrapMap.td;
  41029. function getAll(context, tag) {
  41030. // Support: IE <=9 - 11 only
  41031. // Use typeof to avoid zero-argument method invocation on host objects (#15151)
  41032. var ret;
  41033. if (typeof context.getElementsByTagName !== "undefined") {
  41034. ret = context.getElementsByTagName(tag || "*");
  41035. } else if (typeof context.querySelectorAll !== "undefined") {
  41036. ret = context.querySelectorAll(tag || "*");
  41037. } else {
  41038. ret = [];
  41039. }
  41040. if (tag === undefined || tag && nodeName(context, tag)) {
  41041. return jQuery.merge([context], ret);
  41042. }
  41043. return ret;
  41044. }
  41045. // Mark scripts as having already been evaluated
  41046. function setGlobalEval(elems, refElements) {
  41047. var i = 0,
  41048. l = elems.length;
  41049. for (; i < l; i++) {
  41050. dataPriv.set(elems[i], "globalEval", !refElements || dataPriv.get(refElements[i], "globalEval"));
  41051. }
  41052. }
  41053. var rhtml = /<|&#?\w+;/;
  41054. function buildFragment(elems, context, scripts, selection, ignored) {
  41055. var elem,
  41056. tmp,
  41057. tag,
  41058. wrap,
  41059. contains,
  41060. j,
  41061. fragment = context.createDocumentFragment(),
  41062. nodes = [],
  41063. i = 0,
  41064. l = elems.length;
  41065. for (; i < l; i++) {
  41066. elem = elems[i];
  41067. if (elem || elem === 0) {
  41068. // Add nodes directly
  41069. if (toType(elem) === "object") {
  41070. // Support: Android <=4.0 only, PhantomJS 1 only
  41071. // push.apply(_, arraylike) throws on ancient WebKit
  41072. jQuery.merge(nodes, elem.nodeType ? [elem] : elem);
  41073. // Convert non-html into a text node
  41074. } else if (!rhtml.test(elem)) {
  41075. nodes.push(context.createTextNode(elem));
  41076. // Convert html into DOM nodes
  41077. } else {
  41078. tmp = tmp || fragment.appendChild(context.createElement("div"));
  41079. // Deserialize a standard representation
  41080. tag = (rtagName.exec(elem) || ["", ""])[1].toLowerCase();
  41081. wrap = wrapMap[tag] || wrapMap._default;
  41082. tmp.innerHTML = wrap[1] + jQuery.htmlPrefilter(elem) + wrap[2];
  41083. // Descend through wrappers to the right content
  41084. j = wrap[0];
  41085. while (j--) {
  41086. tmp = tmp.lastChild;
  41087. }
  41088. // Support: Android <=4.0 only, PhantomJS 1 only
  41089. // push.apply(_, arraylike) throws on ancient WebKit
  41090. jQuery.merge(nodes, tmp.childNodes);
  41091. // Remember the top-level container
  41092. tmp = fragment.firstChild;
  41093. // Ensure the created nodes are orphaned (#12392)
  41094. tmp.textContent = "";
  41095. }
  41096. }
  41097. }
  41098. // Remove wrapper from fragment
  41099. fragment.textContent = "";
  41100. i = 0;
  41101. while (elem = nodes[i++]) {
  41102. // Skip elements already in the context collection (trac-4087)
  41103. if (selection && jQuery.inArray(elem, selection) > -1) {
  41104. if (ignored) {
  41105. ignored.push(elem);
  41106. }
  41107. continue;
  41108. }
  41109. contains = jQuery.contains(elem.ownerDocument, elem);
  41110. // Append to fragment
  41111. tmp = getAll(fragment.appendChild(elem), "script");
  41112. // Preserve script evaluation history
  41113. if (contains) {
  41114. setGlobalEval(tmp);
  41115. }
  41116. // Capture executables
  41117. if (scripts) {
  41118. j = 0;
  41119. while (elem = tmp[j++]) {
  41120. if (rscriptType.test(elem.type || "")) {
  41121. scripts.push(elem);
  41122. }
  41123. }
  41124. }
  41125. }
  41126. return fragment;
  41127. }
  41128. (function () {
  41129. var fragment = document.createDocumentFragment(),
  41130. div = fragment.appendChild(document.createElement("div")),
  41131. input = document.createElement("input");
  41132. // Support: Android 4.0 - 4.3 only
  41133. // Check state lost if the name is set (#11217)
  41134. // Support: Windows Web Apps (WWA)
  41135. // `name` and `type` must use .setAttribute for WWA (#14901)
  41136. input.setAttribute("type", "radio");
  41137. input.setAttribute("checked", "checked");
  41138. input.setAttribute("name", "t");
  41139. div.appendChild(input);
  41140. // Support: Android <=4.1 only
  41141. // Older WebKit doesn't clone checked state correctly in fragments
  41142. support.checkClone = div.cloneNode(true).cloneNode(true).lastChild.checked;
  41143. // Support: IE <=11 only
  41144. // Make sure textarea (and checkbox) defaultValue is properly cloned
  41145. div.innerHTML = "<textarea>x</textarea>";
  41146. support.noCloneChecked = !!div.cloneNode(true).lastChild.defaultValue;
  41147. })();
  41148. var documentElement = document.documentElement;
  41149. var rkeyEvent = /^key/,
  41150. rmouseEvent = /^(?:mouse|pointer|contextmenu|drag|drop)|click/,
  41151. rtypenamespace = /^([^.]*)(?:\.(.+)|)/;
  41152. function returnTrue() {
  41153. return true;
  41154. }
  41155. function returnFalse() {
  41156. return false;
  41157. }
  41158. // Support: IE <=9 only
  41159. // See #13393 for more info
  41160. function safeActiveElement() {
  41161. try {
  41162. return document.activeElement;
  41163. } catch (err) {}
  41164. }
  41165. function _on(elem, types, selector, data, fn, one) {
  41166. var origFn, type;
  41167. // Types can be a map of types/handlers
  41168. if ((typeof types === "undefined" ? "undefined" : _typeof(types)) === "object") {
  41169. // ( types-Object, selector, data )
  41170. if (typeof selector !== "string") {
  41171. // ( types-Object, data )
  41172. data = data || selector;
  41173. selector = undefined;
  41174. }
  41175. for (type in types) {
  41176. _on(elem, type, selector, data, types[type], one);
  41177. }
  41178. return elem;
  41179. }
  41180. if (data == null && fn == null) {
  41181. // ( types, fn )
  41182. fn = selector;
  41183. data = selector = undefined;
  41184. } else if (fn == null) {
  41185. if (typeof selector === "string") {
  41186. // ( types, selector, fn )
  41187. fn = data;
  41188. data = undefined;
  41189. } else {
  41190. // ( types, data, fn )
  41191. fn = data;
  41192. data = selector;
  41193. selector = undefined;
  41194. }
  41195. }
  41196. if (fn === false) {
  41197. fn = returnFalse;
  41198. } else if (!fn) {
  41199. return elem;
  41200. }
  41201. if (one === 1) {
  41202. origFn = fn;
  41203. fn = function fn(event) {
  41204. // Can use an empty set, since event contains the info
  41205. jQuery().off(event);
  41206. return origFn.apply(this, arguments);
  41207. };
  41208. // Use same guid so caller can remove using origFn
  41209. fn.guid = origFn.guid || (origFn.guid = jQuery.guid++);
  41210. }
  41211. return elem.each(function () {
  41212. jQuery.event.add(this, types, fn, data, selector);
  41213. });
  41214. }
  41215. /*
  41216. * Helper functions for managing events -- not part of the public interface.
  41217. * Props to Dean Edwards' addEvent library for many of the ideas.
  41218. */
  41219. jQuery.event = {
  41220. global: {},
  41221. add: function add(elem, types, handler, data, selector) {
  41222. var handleObjIn,
  41223. eventHandle,
  41224. tmp,
  41225. events,
  41226. t,
  41227. handleObj,
  41228. special,
  41229. handlers,
  41230. type,
  41231. namespaces,
  41232. origType,
  41233. elemData = dataPriv.get(elem);
  41234. // Don't attach events to noData or text/comment nodes (but allow plain objects)
  41235. if (!elemData) {
  41236. return;
  41237. }
  41238. // Caller can pass in an object of custom data in lieu of the handler
  41239. if (handler.handler) {
  41240. handleObjIn = handler;
  41241. handler = handleObjIn.handler;
  41242. selector = handleObjIn.selector;
  41243. }
  41244. // Ensure that invalid selectors throw exceptions at attach time
  41245. // Evaluate against documentElement in case elem is a non-element node (e.g., document)
  41246. if (selector) {
  41247. jQuery.find.matchesSelector(documentElement, selector);
  41248. }
  41249. // Make sure that the handler has a unique ID, used to find/remove it later
  41250. if (!handler.guid) {
  41251. handler.guid = jQuery.guid++;
  41252. }
  41253. // Init the element's event structure and main handler, if this is the first
  41254. if (!(events = elemData.events)) {
  41255. events = elemData.events = {};
  41256. }
  41257. if (!(eventHandle = elemData.handle)) {
  41258. eventHandle = elemData.handle = function (e) {
  41259. // Discard the second event of a jQuery.event.trigger() and
  41260. // when an event is called after a page has unloaded
  41261. return typeof jQuery !== "undefined" && jQuery.event.triggered !== e.type ? jQuery.event.dispatch.apply(elem, arguments) : undefined;
  41262. };
  41263. }
  41264. // Handle multiple events separated by a space
  41265. types = (types || "").match(rnothtmlwhite) || [""];
  41266. t = types.length;
  41267. while (t--) {
  41268. tmp = rtypenamespace.exec(types[t]) || [];
  41269. type = origType = tmp[1];
  41270. namespaces = (tmp[2] || "").split(".").sort();
  41271. // There *must* be a type, no attaching namespace-only handlers
  41272. if (!type) {
  41273. continue;
  41274. }
  41275. // If event changes its type, use the special event handlers for the changed type
  41276. special = jQuery.event.special[type] || {};
  41277. // If selector defined, determine special event api type, otherwise given type
  41278. type = (selector ? special.delegateType : special.bindType) || type;
  41279. // Update special based on newly reset type
  41280. special = jQuery.event.special[type] || {};
  41281. // handleObj is passed to all event handlers
  41282. handleObj = jQuery.extend({
  41283. type: type,
  41284. origType: origType,
  41285. data: data,
  41286. handler: handler,
  41287. guid: handler.guid,
  41288. selector: selector,
  41289. needsContext: selector && jQuery.expr.match.needsContext.test(selector),
  41290. namespace: namespaces.join(".")
  41291. }, handleObjIn);
  41292. // Init the event handler queue if we're the first
  41293. if (!(handlers = events[type])) {
  41294. handlers = events[type] = [];
  41295. handlers.delegateCount = 0;
  41296. // Only use addEventListener if the special events handler returns false
  41297. if (!special.setup || special.setup.call(elem, data, namespaces, eventHandle) === false) {
  41298. if (elem.addEventListener) {
  41299. elem.addEventListener(type, eventHandle);
  41300. }
  41301. }
  41302. }
  41303. if (special.add) {
  41304. special.add.call(elem, handleObj);
  41305. if (!handleObj.handler.guid) {
  41306. handleObj.handler.guid = handler.guid;
  41307. }
  41308. }
  41309. // Add to the element's handler list, delegates in front
  41310. if (selector) {
  41311. handlers.splice(handlers.delegateCount++, 0, handleObj);
  41312. } else {
  41313. handlers.push(handleObj);
  41314. }
  41315. // Keep track of which events have ever been used, for event optimization
  41316. jQuery.event.global[type] = true;
  41317. }
  41318. },
  41319. // Detach an event or set of events from an element
  41320. remove: function remove(elem, types, handler, selector, mappedTypes) {
  41321. var j,
  41322. origCount,
  41323. tmp,
  41324. events,
  41325. t,
  41326. handleObj,
  41327. special,
  41328. handlers,
  41329. type,
  41330. namespaces,
  41331. origType,
  41332. elemData = dataPriv.hasData(elem) && dataPriv.get(elem);
  41333. if (!elemData || !(events = elemData.events)) {
  41334. return;
  41335. }
  41336. // Once for each type.namespace in types; type may be omitted
  41337. types = (types || "").match(rnothtmlwhite) || [""];
  41338. t = types.length;
  41339. while (t--) {
  41340. tmp = rtypenamespace.exec(types[t]) || [];
  41341. type = origType = tmp[1];
  41342. namespaces = (tmp[2] || "").split(".").sort();
  41343. // Unbind all events (on this namespace, if provided) for the element
  41344. if (!type) {
  41345. for (type in events) {
  41346. jQuery.event.remove(elem, type + types[t], handler, selector, true);
  41347. }
  41348. continue;
  41349. }
  41350. special = jQuery.event.special[type] || {};
  41351. type = (selector ? special.delegateType : special.bindType) || type;
  41352. handlers = events[type] || [];
  41353. tmp = tmp[2] && new RegExp("(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)");
  41354. // Remove matching events
  41355. origCount = j = handlers.length;
  41356. while (j--) {
  41357. handleObj = handlers[j];
  41358. if ((mappedTypes || origType === handleObj.origType) && (!handler || handler.guid === handleObj.guid) && (!tmp || tmp.test(handleObj.namespace)) && (!selector || selector === handleObj.selector || selector === "**" && handleObj.selector)) {
  41359. handlers.splice(j, 1);
  41360. if (handleObj.selector) {
  41361. handlers.delegateCount--;
  41362. }
  41363. if (special.remove) {
  41364. special.remove.call(elem, handleObj);
  41365. }
  41366. }
  41367. }
  41368. // Remove generic event handler if we removed something and no more handlers exist
  41369. // (avoids potential for endless recursion during removal of special event handlers)
  41370. if (origCount && !handlers.length) {
  41371. if (!special.teardown || special.teardown.call(elem, namespaces, elemData.handle) === false) {
  41372. jQuery.removeEvent(elem, type, elemData.handle);
  41373. }
  41374. delete events[type];
  41375. }
  41376. }
  41377. // Remove data and the expando if it's no longer used
  41378. if (jQuery.isEmptyObject(events)) {
  41379. dataPriv.remove(elem, "handle events");
  41380. }
  41381. },
  41382. dispatch: function dispatch(nativeEvent) {
  41383. // Make a writable jQuery.Event from the native event object
  41384. var event = jQuery.event.fix(nativeEvent);
  41385. var i,
  41386. j,
  41387. ret,
  41388. matched,
  41389. handleObj,
  41390. handlerQueue,
  41391. args = new Array(arguments.length),
  41392. handlers = (dataPriv.get(this, "events") || {})[event.type] || [],
  41393. special = jQuery.event.special[event.type] || {};
  41394. // Use the fix-ed jQuery.Event rather than the (read-only) native event
  41395. args[0] = event;
  41396. for (i = 1; i < arguments.length; i++) {
  41397. args[i] = arguments[i];
  41398. }
  41399. event.delegateTarget = this;
  41400. // Call the preDispatch hook for the mapped type, and let it bail if desired
  41401. if (special.preDispatch && special.preDispatch.call(this, event) === false) {
  41402. return;
  41403. }
  41404. // Determine handlers
  41405. handlerQueue = jQuery.event.handlers.call(this, event, handlers);
  41406. // Run delegates first; they may want to stop propagation beneath us
  41407. i = 0;
  41408. while ((matched = handlerQueue[i++]) && !event.isPropagationStopped()) {
  41409. event.currentTarget = matched.elem;
  41410. j = 0;
  41411. while ((handleObj = matched.handlers[j++]) && !event.isImmediatePropagationStopped()) {
  41412. // Triggered event must either 1) have no namespace, or 2) have namespace(s)
  41413. // a subset or equal to those in the bound event (both can have no namespace).
  41414. if (!event.rnamespace || event.rnamespace.test(handleObj.namespace)) {
  41415. event.handleObj = handleObj;
  41416. event.data = handleObj.data;
  41417. ret = ((jQuery.event.special[handleObj.origType] || {}).handle || handleObj.handler).apply(matched.elem, args);
  41418. if (ret !== undefined) {
  41419. if ((event.result = ret) === false) {
  41420. event.preventDefault();
  41421. event.stopPropagation();
  41422. }
  41423. }
  41424. }
  41425. }
  41426. }
  41427. // Call the postDispatch hook for the mapped type
  41428. if (special.postDispatch) {
  41429. special.postDispatch.call(this, event);
  41430. }
  41431. return event.result;
  41432. },
  41433. handlers: function handlers(event, _handlers) {
  41434. var i,
  41435. handleObj,
  41436. sel,
  41437. matchedHandlers,
  41438. matchedSelectors,
  41439. handlerQueue = [],
  41440. delegateCount = _handlers.delegateCount,
  41441. cur = event.target;
  41442. // Find delegate handlers
  41443. if (delegateCount &&
  41444. // Support: IE <=9
  41445. // Black-hole SVG <use> instance trees (trac-13180)
  41446. cur.nodeType &&
  41447. // Support: Firefox <=42
  41448. // Suppress spec-violating clicks indicating a non-primary pointer button (trac-3861)
  41449. // https://www.w3.org/TR/DOM-Level-3-Events/#event-type-click
  41450. // Support: IE 11 only
  41451. // ...but not arrow key "clicks" of radio inputs, which can have `button` -1 (gh-2343)
  41452. !(event.type === "click" && event.button >= 1)) {
  41453. for (; cur !== this; cur = cur.parentNode || this) {
  41454. // Don't check non-elements (#13208)
  41455. // Don't process clicks on disabled elements (#6911, #8165, #11382, #11764)
  41456. if (cur.nodeType === 1 && !(event.type === "click" && cur.disabled === true)) {
  41457. matchedHandlers = [];
  41458. matchedSelectors = {};
  41459. for (i = 0; i < delegateCount; i++) {
  41460. handleObj = _handlers[i];
  41461. // Don't conflict with Object.prototype properties (#13203)
  41462. sel = handleObj.selector + " ";
  41463. if (matchedSelectors[sel] === undefined) {
  41464. matchedSelectors[sel] = handleObj.needsContext ? jQuery(sel, this).index(cur) > -1 : jQuery.find(sel, this, null, [cur]).length;
  41465. }
  41466. if (matchedSelectors[sel]) {
  41467. matchedHandlers.push(handleObj);
  41468. }
  41469. }
  41470. if (matchedHandlers.length) {
  41471. handlerQueue.push({ elem: cur, handlers: matchedHandlers });
  41472. }
  41473. }
  41474. }
  41475. }
  41476. // Add the remaining (directly-bound) handlers
  41477. cur = this;
  41478. if (delegateCount < _handlers.length) {
  41479. handlerQueue.push({ elem: cur, handlers: _handlers.slice(delegateCount) });
  41480. }
  41481. return handlerQueue;
  41482. },
  41483. addProp: function addProp(name, hook) {
  41484. Object.defineProperty(jQuery.Event.prototype, name, {
  41485. enumerable: true,
  41486. configurable: true,
  41487. get: isFunction(hook) ? function () {
  41488. if (this.originalEvent) {
  41489. return hook(this.originalEvent);
  41490. }
  41491. } : function () {
  41492. if (this.originalEvent) {
  41493. return this.originalEvent[name];
  41494. }
  41495. },
  41496. set: function set(value) {
  41497. Object.defineProperty(this, name, {
  41498. enumerable: true,
  41499. configurable: true,
  41500. writable: true,
  41501. value: value
  41502. });
  41503. }
  41504. });
  41505. },
  41506. fix: function fix(originalEvent) {
  41507. return originalEvent[jQuery.expando] ? originalEvent : new jQuery.Event(originalEvent);
  41508. },
  41509. special: {
  41510. load: {
  41511. // Prevent triggered image.load events from bubbling to window.load
  41512. noBubble: true
  41513. },
  41514. focus: {
  41515. // Fire native event if possible so blur/focus sequence is correct
  41516. trigger: function trigger() {
  41517. if (this !== safeActiveElement() && this.focus) {
  41518. this.focus();
  41519. return false;
  41520. }
  41521. },
  41522. delegateType: "focusin"
  41523. },
  41524. blur: {
  41525. trigger: function trigger() {
  41526. if (this === safeActiveElement() && this.blur) {
  41527. this.blur();
  41528. return false;
  41529. }
  41530. },
  41531. delegateType: "focusout"
  41532. },
  41533. click: {
  41534. // For checkbox, fire native event so checked state will be right
  41535. trigger: function trigger() {
  41536. if (this.type === "checkbox" && this.click && nodeName(this, "input")) {
  41537. this.click();
  41538. return false;
  41539. }
  41540. },
  41541. // For cross-browser consistency, don't fire native .click() on links
  41542. _default: function _default(event) {
  41543. return nodeName(event.target, "a");
  41544. }
  41545. },
  41546. beforeunload: {
  41547. postDispatch: function postDispatch(event) {
  41548. // Support: Firefox 20+
  41549. // Firefox doesn't alert if the returnValue field is not set.
  41550. if (event.result !== undefined && event.originalEvent) {
  41551. event.originalEvent.returnValue = event.result;
  41552. }
  41553. }
  41554. }
  41555. }
  41556. };
  41557. jQuery.removeEvent = function (elem, type, handle) {
  41558. // This "if" is needed for plain objects
  41559. if (elem.removeEventListener) {
  41560. elem.removeEventListener(type, handle);
  41561. }
  41562. };
  41563. jQuery.Event = function (src, props) {
  41564. // Allow instantiation without the 'new' keyword
  41565. if (!(this instanceof jQuery.Event)) {
  41566. return new jQuery.Event(src, props);
  41567. }
  41568. // Event object
  41569. if (src && src.type) {
  41570. this.originalEvent = src;
  41571. this.type = src.type;
  41572. // Events bubbling up the document may have been marked as prevented
  41573. // by a handler lower down the tree; reflect the correct value.
  41574. this.isDefaultPrevented = src.defaultPrevented || src.defaultPrevented === undefined &&
  41575. // Support: Android <=2.3 only
  41576. src.returnValue === false ? returnTrue : returnFalse;
  41577. // Create target properties
  41578. // Support: Safari <=6 - 7 only
  41579. // Target should not be a text node (#504, #13143)
  41580. this.target = src.target && src.target.nodeType === 3 ? src.target.parentNode : src.target;
  41581. this.currentTarget = src.currentTarget;
  41582. this.relatedTarget = src.relatedTarget;
  41583. // Event type
  41584. } else {
  41585. this.type = src;
  41586. }
  41587. // Put explicitly provided properties onto the event object
  41588. if (props) {
  41589. jQuery.extend(this, props);
  41590. }
  41591. // Create a timestamp if incoming event doesn't have one
  41592. this.timeStamp = src && src.timeStamp || Date.now();
  41593. // Mark it as fixed
  41594. this[jQuery.expando] = true;
  41595. };
  41596. // jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding
  41597. // https://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html
  41598. jQuery.Event.prototype = {
  41599. constructor: jQuery.Event,
  41600. isDefaultPrevented: returnFalse,
  41601. isPropagationStopped: returnFalse,
  41602. isImmediatePropagationStopped: returnFalse,
  41603. isSimulated: false,
  41604. preventDefault: function preventDefault() {
  41605. var e = this.originalEvent;
  41606. this.isDefaultPrevented = returnTrue;
  41607. if (e && !this.isSimulated) {
  41608. e.preventDefault();
  41609. }
  41610. },
  41611. stopPropagation: function stopPropagation() {
  41612. var e = this.originalEvent;
  41613. this.isPropagationStopped = returnTrue;
  41614. if (e && !this.isSimulated) {
  41615. e.stopPropagation();
  41616. }
  41617. },
  41618. stopImmediatePropagation: function stopImmediatePropagation() {
  41619. var e = this.originalEvent;
  41620. this.isImmediatePropagationStopped = returnTrue;
  41621. if (e && !this.isSimulated) {
  41622. e.stopImmediatePropagation();
  41623. }
  41624. this.stopPropagation();
  41625. }
  41626. };
  41627. // Includes all common event props including KeyEvent and MouseEvent specific props
  41628. jQuery.each({
  41629. altKey: true,
  41630. bubbles: true,
  41631. cancelable: true,
  41632. changedTouches: true,
  41633. ctrlKey: true,
  41634. detail: true,
  41635. eventPhase: true,
  41636. metaKey: true,
  41637. pageX: true,
  41638. pageY: true,
  41639. shiftKey: true,
  41640. view: true,
  41641. "char": true,
  41642. charCode: true,
  41643. key: true,
  41644. keyCode: true,
  41645. button: true,
  41646. buttons: true,
  41647. clientX: true,
  41648. clientY: true,
  41649. offsetX: true,
  41650. offsetY: true,
  41651. pointerId: true,
  41652. pointerType: true,
  41653. screenX: true,
  41654. screenY: true,
  41655. targetTouches: true,
  41656. toElement: true,
  41657. touches: true,
  41658. which: function which(event) {
  41659. var button = event.button;
  41660. // Add which for key events
  41661. if (event.which == null && rkeyEvent.test(event.type)) {
  41662. return event.charCode != null ? event.charCode : event.keyCode;
  41663. }
  41664. // Add which for click: 1 === left; 2 === middle; 3 === right
  41665. if (!event.which && button !== undefined && rmouseEvent.test(event.type)) {
  41666. if (button & 1) {
  41667. return 1;
  41668. }
  41669. if (button & 2) {
  41670. return 3;
  41671. }
  41672. if (button & 4) {
  41673. return 2;
  41674. }
  41675. return 0;
  41676. }
  41677. return event.which;
  41678. }
  41679. }, jQuery.event.addProp);
  41680. // Create mouseenter/leave events using mouseover/out and event-time checks
  41681. // so that event delegation works in jQuery.
  41682. // Do the same for pointerenter/pointerleave and pointerover/pointerout
  41683. //
  41684. // Support: Safari 7 only
  41685. // Safari sends mouseenter too often; see:
  41686. // https://bugs.chromium.org/p/chromium/issues/detail?id=470258
  41687. // for the description of the bug (it existed in older Chrome versions as well).
  41688. jQuery.each({
  41689. mouseenter: "mouseover",
  41690. mouseleave: "mouseout",
  41691. pointerenter: "pointerover",
  41692. pointerleave: "pointerout"
  41693. }, function (orig, fix) {
  41694. jQuery.event.special[orig] = {
  41695. delegateType: fix,
  41696. bindType: fix,
  41697. handle: function handle(event) {
  41698. var ret,
  41699. target = this,
  41700. related = event.relatedTarget,
  41701. handleObj = event.handleObj;
  41702. // For mouseenter/leave call the handler if related is outside the target.
  41703. // NB: No relatedTarget if the mouse left/entered the browser window
  41704. if (!related || related !== target && !jQuery.contains(target, related)) {
  41705. event.type = handleObj.origType;
  41706. ret = handleObj.handler.apply(this, arguments);
  41707. event.type = fix;
  41708. }
  41709. return ret;
  41710. }
  41711. };
  41712. });
  41713. jQuery.fn.extend({
  41714. on: function on(types, selector, data, fn) {
  41715. return _on(this, types, selector, data, fn);
  41716. },
  41717. one: function one(types, selector, data, fn) {
  41718. return _on(this, types, selector, data, fn, 1);
  41719. },
  41720. off: function off(types, selector, fn) {
  41721. var handleObj, type;
  41722. if (types && types.preventDefault && types.handleObj) {
  41723. // ( event ) dispatched jQuery.Event
  41724. handleObj = types.handleObj;
  41725. jQuery(types.delegateTarget).off(handleObj.namespace ? handleObj.origType + "." + handleObj.namespace : handleObj.origType, handleObj.selector, handleObj.handler);
  41726. return this;
  41727. }
  41728. if ((typeof types === "undefined" ? "undefined" : _typeof(types)) === "object") {
  41729. // ( types-object [, selector] )
  41730. for (type in types) {
  41731. this.off(type, selector, types[type]);
  41732. }
  41733. return this;
  41734. }
  41735. if (selector === false || typeof selector === "function") {
  41736. // ( types [, fn] )
  41737. fn = selector;
  41738. selector = undefined;
  41739. }
  41740. if (fn === false) {
  41741. fn = returnFalse;
  41742. }
  41743. return this.each(function () {
  41744. jQuery.event.remove(this, types, fn, selector);
  41745. });
  41746. }
  41747. });
  41748. var
  41749. /* eslint-disable max-len */
  41750. // See https://github.com/eslint/eslint/issues/3229
  41751. rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([a-z][^\/\0>\x20\t\r\n\f]*)[^>]*)\/>/gi,
  41752. /* eslint-enable */
  41753. // Support: IE <=10 - 11, Edge 12 - 13 only
  41754. // In IE/Edge using regex groups here causes severe slowdowns.
  41755. // See https://connect.microsoft.com/IE/feedback/details/1736512/
  41756. rnoInnerhtml = /<script|<style|<link/i,
  41757. // checked="checked" or checked
  41758. rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i,
  41759. rcleanScript = /^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g;
  41760. // Prefer a tbody over its parent table for containing new rows
  41761. function manipulationTarget(elem, content) {
  41762. if (nodeName(elem, "table") && nodeName(content.nodeType !== 11 ? content : content.firstChild, "tr")) {
  41763. return jQuery(elem).children("tbody")[0] || elem;
  41764. }
  41765. return elem;
  41766. }
  41767. // Replace/restore the type attribute of script elements for safe DOM manipulation
  41768. function disableScript(elem) {
  41769. elem.type = (elem.getAttribute("type") !== null) + "/" + elem.type;
  41770. return elem;
  41771. }
  41772. function restoreScript(elem) {
  41773. if ((elem.type || "").slice(0, 5) === "true/") {
  41774. elem.type = elem.type.slice(5);
  41775. } else {
  41776. elem.removeAttribute("type");
  41777. }
  41778. return elem;
  41779. }
  41780. function cloneCopyEvent(src, dest) {
  41781. var i, l, type, pdataOld, pdataCur, udataOld, udataCur, events;
  41782. if (dest.nodeType !== 1) {
  41783. return;
  41784. }
  41785. // 1. Copy private data: events, handlers, etc.
  41786. if (dataPriv.hasData(src)) {
  41787. pdataOld = dataPriv.access(src);
  41788. pdataCur = dataPriv.set(dest, pdataOld);
  41789. events = pdataOld.events;
  41790. if (events) {
  41791. delete pdataCur.handle;
  41792. pdataCur.events = {};
  41793. for (type in events) {
  41794. for (i = 0, l = events[type].length; i < l; i++) {
  41795. jQuery.event.add(dest, type, events[type][i]);
  41796. }
  41797. }
  41798. }
  41799. }
  41800. // 2. Copy user data
  41801. if (dataUser.hasData(src)) {
  41802. udataOld = dataUser.access(src);
  41803. udataCur = jQuery.extend({}, udataOld);
  41804. dataUser.set(dest, udataCur);
  41805. }
  41806. }
  41807. // Fix IE bugs, see support tests
  41808. function fixInput(src, dest) {
  41809. var nodeName = dest.nodeName.toLowerCase();
  41810. // Fails to persist the checked state of a cloned checkbox or radio button.
  41811. if (nodeName === "input" && rcheckableType.test(src.type)) {
  41812. dest.checked = src.checked;
  41813. // Fails to return the selected option to the default selected state when cloning options
  41814. } else if (nodeName === "input" || nodeName === "textarea") {
  41815. dest.defaultValue = src.defaultValue;
  41816. }
  41817. }
  41818. function domManip(collection, args, callback, ignored) {
  41819. // Flatten any nested arrays
  41820. args = concat.apply([], args);
  41821. var fragment,
  41822. first,
  41823. scripts,
  41824. hasScripts,
  41825. node,
  41826. doc,
  41827. i = 0,
  41828. l = collection.length,
  41829. iNoClone = l - 1,
  41830. value = args[0],
  41831. valueIsFunction = isFunction(value);
  41832. // We can't cloneNode fragments that contain checked, in WebKit
  41833. if (valueIsFunction || l > 1 && typeof value === "string" && !support.checkClone && rchecked.test(value)) {
  41834. return collection.each(function (index) {
  41835. var self = collection.eq(index);
  41836. if (valueIsFunction) {
  41837. args[0] = value.call(this, index, self.html());
  41838. }
  41839. domManip(self, args, callback, ignored);
  41840. });
  41841. }
  41842. if (l) {
  41843. fragment = buildFragment(args, collection[0].ownerDocument, false, collection, ignored);
  41844. first = fragment.firstChild;
  41845. if (fragment.childNodes.length === 1) {
  41846. fragment = first;
  41847. }
  41848. // Require either new content or an interest in ignored elements to invoke the callback
  41849. if (first || ignored) {
  41850. scripts = jQuery.map(getAll(fragment, "script"), disableScript);
  41851. hasScripts = scripts.length;
  41852. // Use the original fragment for the last item
  41853. // instead of the first because it can end up
  41854. // being emptied incorrectly in certain situations (#8070).
  41855. for (; i < l; i++) {
  41856. node = fragment;
  41857. if (i !== iNoClone) {
  41858. node = jQuery.clone(node, true, true);
  41859. // Keep references to cloned scripts for later restoration
  41860. if (hasScripts) {
  41861. // Support: Android <=4.0 only, PhantomJS 1 only
  41862. // push.apply(_, arraylike) throws on ancient WebKit
  41863. jQuery.merge(scripts, getAll(node, "script"));
  41864. }
  41865. }
  41866. callback.call(collection[i], node, i);
  41867. }
  41868. if (hasScripts) {
  41869. doc = scripts[scripts.length - 1].ownerDocument;
  41870. // Reenable scripts
  41871. jQuery.map(scripts, restoreScript);
  41872. // Evaluate executable scripts on first document insertion
  41873. for (i = 0; i < hasScripts; i++) {
  41874. node = scripts[i];
  41875. if (rscriptType.test(node.type || "") && !dataPriv.access(node, "globalEval") && jQuery.contains(doc, node)) {
  41876. if (node.src && (node.type || "").toLowerCase() !== "module") {
  41877. // Optional AJAX dependency, but won't run scripts if not present
  41878. if (jQuery._evalUrl) {
  41879. jQuery._evalUrl(node.src);
  41880. }
  41881. } else {
  41882. DOMEval(node.textContent.replace(rcleanScript, ""), doc, node);
  41883. }
  41884. }
  41885. }
  41886. }
  41887. }
  41888. }
  41889. return collection;
  41890. }
  41891. function _remove(elem, selector, keepData) {
  41892. var node,
  41893. nodes = selector ? jQuery.filter(selector, elem) : elem,
  41894. i = 0;
  41895. for (; (node = nodes[i]) != null; i++) {
  41896. if (!keepData && node.nodeType === 1) {
  41897. jQuery.cleanData(getAll(node));
  41898. }
  41899. if (node.parentNode) {
  41900. if (keepData && jQuery.contains(node.ownerDocument, node)) {
  41901. setGlobalEval(getAll(node, "script"));
  41902. }
  41903. node.parentNode.removeChild(node);
  41904. }
  41905. }
  41906. return elem;
  41907. }
  41908. jQuery.extend({
  41909. htmlPrefilter: function htmlPrefilter(html) {
  41910. return html.replace(rxhtmlTag, "<$1></$2>");
  41911. },
  41912. clone: function clone(elem, dataAndEvents, deepDataAndEvents) {
  41913. var i,
  41914. l,
  41915. srcElements,
  41916. destElements,
  41917. clone = elem.cloneNode(true),
  41918. inPage = jQuery.contains(elem.ownerDocument, elem);
  41919. // Fix IE cloning issues
  41920. if (!support.noCloneChecked && (elem.nodeType === 1 || elem.nodeType === 11) && !jQuery.isXMLDoc(elem)) {
  41921. // We eschew Sizzle here for performance reasons: https://jsperf.com/getall-vs-sizzle/2
  41922. destElements = getAll(clone);
  41923. srcElements = getAll(elem);
  41924. for (i = 0, l = srcElements.length; i < l; i++) {
  41925. fixInput(srcElements[i], destElements[i]);
  41926. }
  41927. }
  41928. // Copy the events from the original to the clone
  41929. if (dataAndEvents) {
  41930. if (deepDataAndEvents) {
  41931. srcElements = srcElements || getAll(elem);
  41932. destElements = destElements || getAll(clone);
  41933. for (i = 0, l = srcElements.length; i < l; i++) {
  41934. cloneCopyEvent(srcElements[i], destElements[i]);
  41935. }
  41936. } else {
  41937. cloneCopyEvent(elem, clone);
  41938. }
  41939. }
  41940. // Preserve script evaluation history
  41941. destElements = getAll(clone, "script");
  41942. if (destElements.length > 0) {
  41943. setGlobalEval(destElements, !inPage && getAll(elem, "script"));
  41944. }
  41945. // Return the cloned set
  41946. return clone;
  41947. },
  41948. cleanData: function cleanData(elems) {
  41949. var data,
  41950. elem,
  41951. type,
  41952. special = jQuery.event.special,
  41953. i = 0;
  41954. for (; (elem = elems[i]) !== undefined; i++) {
  41955. if (acceptData(elem)) {
  41956. if (data = elem[dataPriv.expando]) {
  41957. if (data.events) {
  41958. for (type in data.events) {
  41959. if (special[type]) {
  41960. jQuery.event.remove(elem, type);
  41961. // This is a shortcut to avoid jQuery.event.remove's overhead
  41962. } else {
  41963. jQuery.removeEvent(elem, type, data.handle);
  41964. }
  41965. }
  41966. }
  41967. // Support: Chrome <=35 - 45+
  41968. // Assign undefined instead of using delete, see Data#remove
  41969. elem[dataPriv.expando] = undefined;
  41970. }
  41971. if (elem[dataUser.expando]) {
  41972. // Support: Chrome <=35 - 45+
  41973. // Assign undefined instead of using delete, see Data#remove
  41974. elem[dataUser.expando] = undefined;
  41975. }
  41976. }
  41977. }
  41978. }
  41979. });
  41980. jQuery.fn.extend({
  41981. detach: function detach(selector) {
  41982. return _remove(this, selector, true);
  41983. },
  41984. remove: function remove(selector) {
  41985. return _remove(this, selector);
  41986. },
  41987. text: function text(value) {
  41988. return access(this, function (value) {
  41989. return value === undefined ? jQuery.text(this) : this.empty().each(function () {
  41990. if (this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9) {
  41991. this.textContent = value;
  41992. }
  41993. });
  41994. }, null, value, arguments.length);
  41995. },
  41996. append: function append() {
  41997. return domManip(this, arguments, function (elem) {
  41998. if (this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9) {
  41999. var target = manipulationTarget(this, elem);
  42000. target.appendChild(elem);
  42001. }
  42002. });
  42003. },
  42004. prepend: function prepend() {
  42005. return domManip(this, arguments, function (elem) {
  42006. if (this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9) {
  42007. var target = manipulationTarget(this, elem);
  42008. target.insertBefore(elem, target.firstChild);
  42009. }
  42010. });
  42011. },
  42012. before: function before() {
  42013. return domManip(this, arguments, function (elem) {
  42014. if (this.parentNode) {
  42015. this.parentNode.insertBefore(elem, this);
  42016. }
  42017. });
  42018. },
  42019. after: function after() {
  42020. return domManip(this, arguments, function (elem) {
  42021. if (this.parentNode) {
  42022. this.parentNode.insertBefore(elem, this.nextSibling);
  42023. }
  42024. });
  42025. },
  42026. empty: function empty() {
  42027. var elem,
  42028. i = 0;
  42029. for (; (elem = this[i]) != null; i++) {
  42030. if (elem.nodeType === 1) {
  42031. // Prevent memory leaks
  42032. jQuery.cleanData(getAll(elem, false));
  42033. // Remove any remaining nodes
  42034. elem.textContent = "";
  42035. }
  42036. }
  42037. return this;
  42038. },
  42039. clone: function clone(dataAndEvents, deepDataAndEvents) {
  42040. dataAndEvents = dataAndEvents == null ? false : dataAndEvents;
  42041. deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents;
  42042. return this.map(function () {
  42043. return jQuery.clone(this, dataAndEvents, deepDataAndEvents);
  42044. });
  42045. },
  42046. html: function html(value) {
  42047. return access(this, function (value) {
  42048. var elem = this[0] || {},
  42049. i = 0,
  42050. l = this.length;
  42051. if (value === undefined && elem.nodeType === 1) {
  42052. return elem.innerHTML;
  42053. }
  42054. // See if we can take a shortcut and just use innerHTML
  42055. if (typeof value === "string" && !rnoInnerhtml.test(value) && !wrapMap[(rtagName.exec(value) || ["", ""])[1].toLowerCase()]) {
  42056. value = jQuery.htmlPrefilter(value);
  42057. try {
  42058. for (; i < l; i++) {
  42059. elem = this[i] || {};
  42060. // Remove element nodes and prevent memory leaks
  42061. if (elem.nodeType === 1) {
  42062. jQuery.cleanData(getAll(elem, false));
  42063. elem.innerHTML = value;
  42064. }
  42065. }
  42066. elem = 0;
  42067. // If using innerHTML throws an exception, use the fallback method
  42068. } catch (e) {}
  42069. }
  42070. if (elem) {
  42071. this.empty().append(value);
  42072. }
  42073. }, null, value, arguments.length);
  42074. },
  42075. replaceWith: function replaceWith() {
  42076. var ignored = [];
  42077. // Make the changes, replacing each non-ignored context element with the new content
  42078. return domManip(this, arguments, function (elem) {
  42079. var parent = this.parentNode;
  42080. if (jQuery.inArray(this, ignored) < 0) {
  42081. jQuery.cleanData(getAll(this));
  42082. if (parent) {
  42083. parent.replaceChild(elem, this);
  42084. }
  42085. }
  42086. // Force callback invocation
  42087. }, ignored);
  42088. }
  42089. });
  42090. jQuery.each({
  42091. appendTo: "append",
  42092. prependTo: "prepend",
  42093. insertBefore: "before",
  42094. insertAfter: "after",
  42095. replaceAll: "replaceWith"
  42096. }, function (name, original) {
  42097. jQuery.fn[name] = function (selector) {
  42098. var elems,
  42099. ret = [],
  42100. insert = jQuery(selector),
  42101. last = insert.length - 1,
  42102. i = 0;
  42103. for (; i <= last; i++) {
  42104. elems = i === last ? this : this.clone(true);
  42105. jQuery(insert[i])[original](elems);
  42106. // Support: Android <=4.0 only, PhantomJS 1 only
  42107. // .get() because push.apply(_, arraylike) throws on ancient WebKit
  42108. push.apply(ret, elems.get());
  42109. }
  42110. return this.pushStack(ret);
  42111. };
  42112. });
  42113. var rnumnonpx = new RegExp("^(" + pnum + ")(?!px)[a-z%]+$", "i");
  42114. var getStyles = function getStyles(elem) {
  42115. // Support: IE <=11 only, Firefox <=30 (#15098, #14150)
  42116. // IE throws on elements created in popups
  42117. // FF meanwhile throws on frame elements through "defaultView.getComputedStyle"
  42118. var view = elem.ownerDocument.defaultView;
  42119. if (!view || !view.opener) {
  42120. view = window;
  42121. }
  42122. return view.getComputedStyle(elem);
  42123. };
  42124. var rboxStyle = new RegExp(cssExpand.join("|"), "i");
  42125. (function () {
  42126. // Executing both pixelPosition & boxSizingReliable tests require only one layout
  42127. // so they're executed at the same time to save the second computation.
  42128. function computeStyleTests() {
  42129. // This is a singleton, we need to execute it only once
  42130. if (!div) {
  42131. return;
  42132. }
  42133. container.style.cssText = "position:absolute;left:-11111px;width:60px;" + "margin-top:1px;padding:0;border:0";
  42134. div.style.cssText = "position:relative;display:block;box-sizing:border-box;overflow:scroll;" + "margin:auto;border:1px;padding:1px;" + "width:60%;top:1%";
  42135. documentElement.appendChild(container).appendChild(div);
  42136. var divStyle = window.getComputedStyle(div);
  42137. pixelPositionVal = divStyle.top !== "1%";
  42138. // Support: Android 4.0 - 4.3 only, Firefox <=3 - 44
  42139. reliableMarginLeftVal = roundPixelMeasures(divStyle.marginLeft) === 12;
  42140. // Support: Android 4.0 - 4.3 only, Safari <=9.1 - 10.1, iOS <=7.0 - 9.3
  42141. // Some styles come back with percentage values, even though they shouldn't
  42142. div.style.right = "60%";
  42143. pixelBoxStylesVal = roundPixelMeasures(divStyle.right) === 36;
  42144. // Support: IE 9 - 11 only
  42145. // Detect misreporting of content dimensions for box-sizing:border-box elements
  42146. boxSizingReliableVal = roundPixelMeasures(divStyle.width) === 36;
  42147. // Support: IE 9 only
  42148. // Detect overflow:scroll screwiness (gh-3699)
  42149. div.style.position = "absolute";
  42150. scrollboxSizeVal = div.offsetWidth === 36 || "absolute";
  42151. documentElement.removeChild(container);
  42152. // Nullify the div so it wouldn't be stored in the memory and
  42153. // it will also be a sign that checks already performed
  42154. div = null;
  42155. }
  42156. function roundPixelMeasures(measure) {
  42157. return Math.round(parseFloat(measure));
  42158. }
  42159. var pixelPositionVal,
  42160. boxSizingReliableVal,
  42161. scrollboxSizeVal,
  42162. pixelBoxStylesVal,
  42163. reliableMarginLeftVal,
  42164. container = document.createElement("div"),
  42165. div = document.createElement("div");
  42166. // Finish early in limited (non-browser) environments
  42167. if (!div.style) {
  42168. return;
  42169. }
  42170. // Support: IE <=9 - 11 only
  42171. // Style of cloned element affects source element cloned (#8908)
  42172. div.style.backgroundClip = "content-box";
  42173. div.cloneNode(true).style.backgroundClip = "";
  42174. support.clearCloneStyle = div.style.backgroundClip === "content-box";
  42175. jQuery.extend(support, {
  42176. boxSizingReliable: function boxSizingReliable() {
  42177. computeStyleTests();
  42178. return boxSizingReliableVal;
  42179. },
  42180. pixelBoxStyles: function pixelBoxStyles() {
  42181. computeStyleTests();
  42182. return pixelBoxStylesVal;
  42183. },
  42184. pixelPosition: function pixelPosition() {
  42185. computeStyleTests();
  42186. return pixelPositionVal;
  42187. },
  42188. reliableMarginLeft: function reliableMarginLeft() {
  42189. computeStyleTests();
  42190. return reliableMarginLeftVal;
  42191. },
  42192. scrollboxSize: function scrollboxSize() {
  42193. computeStyleTests();
  42194. return scrollboxSizeVal;
  42195. }
  42196. });
  42197. })();
  42198. function curCSS(elem, name, computed) {
  42199. var width,
  42200. minWidth,
  42201. maxWidth,
  42202. ret,
  42203. // Support: Firefox 51+
  42204. // Retrieving style before computed somehow
  42205. // fixes an issue with getting wrong values
  42206. // on detached elements
  42207. style = elem.style;
  42208. computed = computed || getStyles(elem);
  42209. // getPropertyValue is needed for:
  42210. // .css('filter') (IE 9 only, #12537)
  42211. // .css('--customProperty) (#3144)
  42212. if (computed) {
  42213. ret = computed.getPropertyValue(name) || computed[name];
  42214. if (ret === "" && !jQuery.contains(elem.ownerDocument, elem)) {
  42215. ret = jQuery.style(elem, name);
  42216. }
  42217. // A tribute to the "awesome hack by Dean Edwards"
  42218. // Android Browser returns percentage for some values,
  42219. // but width seems to be reliably pixels.
  42220. // This is against the CSSOM draft spec:
  42221. // https://drafts.csswg.org/cssom/#resolved-values
  42222. if (!support.pixelBoxStyles() && rnumnonpx.test(ret) && rboxStyle.test(name)) {
  42223. // Remember the original values
  42224. width = style.width;
  42225. minWidth = style.minWidth;
  42226. maxWidth = style.maxWidth;
  42227. // Put in the new values to get a computed value out
  42228. style.minWidth = style.maxWidth = style.width = ret;
  42229. ret = computed.width;
  42230. // Revert the changed values
  42231. style.width = width;
  42232. style.minWidth = minWidth;
  42233. style.maxWidth = maxWidth;
  42234. }
  42235. }
  42236. return ret !== undefined ?
  42237. // Support: IE <=9 - 11 only
  42238. // IE returns zIndex value as an integer.
  42239. ret + "" : ret;
  42240. }
  42241. function addGetHookIf(conditionFn, hookFn) {
  42242. // Define the hook, we'll check on the first run if it's really needed.
  42243. return {
  42244. get: function get() {
  42245. if (conditionFn()) {
  42246. // Hook not needed (or it's not possible to use it due
  42247. // to missing dependency), remove it.
  42248. delete this.get;
  42249. return;
  42250. }
  42251. // Hook needed; redefine it so that the support test is not executed again.
  42252. return (this.get = hookFn).apply(this, arguments);
  42253. }
  42254. };
  42255. }
  42256. var
  42257. // Swappable if display is none or starts with table
  42258. // except "table", "table-cell", or "table-caption"
  42259. // See here for display values: https://developer.mozilla.org/en-US/docs/CSS/display
  42260. rdisplayswap = /^(none|table(?!-c[ea]).+)/,
  42261. rcustomProp = /^--/,
  42262. cssShow = { position: "absolute", visibility: "hidden", display: "block" },
  42263. cssNormalTransform = {
  42264. letterSpacing: "0",
  42265. fontWeight: "400"
  42266. },
  42267. cssPrefixes = ["Webkit", "Moz", "ms"],
  42268. emptyStyle = document.createElement("div").style;
  42269. // Return a css property mapped to a potentially vendor prefixed property
  42270. function vendorPropName(name) {
  42271. // Shortcut for names that are not vendor prefixed
  42272. if (name in emptyStyle) {
  42273. return name;
  42274. }
  42275. // Check for vendor prefixed names
  42276. var capName = name[0].toUpperCase() + name.slice(1),
  42277. i = cssPrefixes.length;
  42278. while (i--) {
  42279. name = cssPrefixes[i] + capName;
  42280. if (name in emptyStyle) {
  42281. return name;
  42282. }
  42283. }
  42284. }
  42285. // Return a property mapped along what jQuery.cssProps suggests or to
  42286. // a vendor prefixed property.
  42287. function finalPropName(name) {
  42288. var ret = jQuery.cssProps[name];
  42289. if (!ret) {
  42290. ret = jQuery.cssProps[name] = vendorPropName(name) || name;
  42291. }
  42292. return ret;
  42293. }
  42294. function setPositiveNumber(elem, value, subtract) {
  42295. // Any relative (+/-) values have already been
  42296. // normalized at this point
  42297. var matches = rcssNum.exec(value);
  42298. return matches ?
  42299. // Guard against undefined "subtract", e.g., when used as in cssHooks
  42300. Math.max(0, matches[2] - (subtract || 0)) + (matches[3] || "px") : value;
  42301. }
  42302. function boxModelAdjustment(elem, dimension, box, isBorderBox, styles, computedVal) {
  42303. var i = dimension === "width" ? 1 : 0,
  42304. extra = 0,
  42305. delta = 0;
  42306. // Adjustment may not be necessary
  42307. if (box === (isBorderBox ? "border" : "content")) {
  42308. return 0;
  42309. }
  42310. for (; i < 4; i += 2) {
  42311. // Both box models exclude margin
  42312. if (box === "margin") {
  42313. delta += jQuery.css(elem, box + cssExpand[i], true, styles);
  42314. }
  42315. // If we get here with a content-box, we're seeking "padding" or "border" or "margin"
  42316. if (!isBorderBox) {
  42317. // Add padding
  42318. delta += jQuery.css(elem, "padding" + cssExpand[i], true, styles);
  42319. // For "border" or "margin", add border
  42320. if (box !== "padding") {
  42321. delta += jQuery.css(elem, "border" + cssExpand[i] + "Width", true, styles);
  42322. // But still keep track of it otherwise
  42323. } else {
  42324. extra += jQuery.css(elem, "border" + cssExpand[i] + "Width", true, styles);
  42325. }
  42326. // If we get here with a border-box (content + padding + border), we're seeking "content" or
  42327. // "padding" or "margin"
  42328. } else {
  42329. // For "content", subtract padding
  42330. if (box === "content") {
  42331. delta -= jQuery.css(elem, "padding" + cssExpand[i], true, styles);
  42332. }
  42333. // For "content" or "padding", subtract border
  42334. if (box !== "margin") {
  42335. delta -= jQuery.css(elem, "border" + cssExpand[i] + "Width", true, styles);
  42336. }
  42337. }
  42338. }
  42339. // Account for positive content-box scroll gutter when requested by providing computedVal
  42340. if (!isBorderBox && computedVal >= 0) {
  42341. // offsetWidth/offsetHeight is a rounded sum of content, padding, scroll gutter, and border
  42342. // Assuming integer scroll gutter, subtract the rest and round down
  42343. delta += Math.max(0, Math.ceil(elem["offset" + dimension[0].toUpperCase() + dimension.slice(1)] - computedVal - delta - extra - 0.5));
  42344. }
  42345. return delta;
  42346. }
  42347. function getWidthOrHeight(elem, dimension, extra) {
  42348. // Start with computed style
  42349. var styles = getStyles(elem),
  42350. val = curCSS(elem, dimension, styles),
  42351. isBorderBox = jQuery.css(elem, "boxSizing", false, styles) === "border-box",
  42352. valueIsBorderBox = isBorderBox;
  42353. // Support: Firefox <=54
  42354. // Return a confounding non-pixel value or feign ignorance, as appropriate.
  42355. if (rnumnonpx.test(val)) {
  42356. if (!extra) {
  42357. return val;
  42358. }
  42359. val = "auto";
  42360. }
  42361. // Check for style in case a browser which returns unreliable values
  42362. // for getComputedStyle silently falls back to the reliable elem.style
  42363. valueIsBorderBox = valueIsBorderBox && (support.boxSizingReliable() || val === elem.style[dimension]);
  42364. // Fall back to offsetWidth/offsetHeight when value is "auto"
  42365. // This happens for inline elements with no explicit setting (gh-3571)
  42366. // Support: Android <=4.1 - 4.3 only
  42367. // Also use offsetWidth/offsetHeight for misreported inline dimensions (gh-3602)
  42368. if (val === "auto" || !parseFloat(val) && jQuery.css(elem, "display", false, styles) === "inline") {
  42369. val = elem["offset" + dimension[0].toUpperCase() + dimension.slice(1)];
  42370. // offsetWidth/offsetHeight provide border-box values
  42371. valueIsBorderBox = true;
  42372. }
  42373. // Normalize "" and auto
  42374. val = parseFloat(val) || 0;
  42375. // Adjust for the element's box model
  42376. return val + boxModelAdjustment(elem, dimension, extra || (isBorderBox ? "border" : "content"), valueIsBorderBox, styles,
  42377. // Provide the current computed size to request scroll gutter calculation (gh-3589)
  42378. val) + "px";
  42379. }
  42380. jQuery.extend({
  42381. // Add in style property hooks for overriding the default
  42382. // behavior of getting and setting a style property
  42383. cssHooks: {
  42384. opacity: {
  42385. get: function get(elem, computed) {
  42386. if (computed) {
  42387. // We should always get a number back from opacity
  42388. var ret = curCSS(elem, "opacity");
  42389. return ret === "" ? "1" : ret;
  42390. }
  42391. }
  42392. }
  42393. },
  42394. // Don't automatically add "px" to these possibly-unitless properties
  42395. cssNumber: {
  42396. "animationIterationCount": true,
  42397. "columnCount": true,
  42398. "fillOpacity": true,
  42399. "flexGrow": true,
  42400. "flexShrink": true,
  42401. "fontWeight": true,
  42402. "lineHeight": true,
  42403. "opacity": true,
  42404. "order": true,
  42405. "orphans": true,
  42406. "widows": true,
  42407. "zIndex": true,
  42408. "zoom": true
  42409. },
  42410. // Add in properties whose names you wish to fix before
  42411. // setting or getting the value
  42412. cssProps: {},
  42413. // Get and set the style property on a DOM Node
  42414. style: function style(elem, name, value, extra) {
  42415. // Don't set styles on text and comment nodes
  42416. if (!elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style) {
  42417. return;
  42418. }
  42419. // Make sure that we're working with the right name
  42420. var ret,
  42421. type,
  42422. hooks,
  42423. origName = camelCase(name),
  42424. isCustomProp = rcustomProp.test(name),
  42425. style = elem.style;
  42426. // Make sure that we're working with the right name. We don't
  42427. // want to query the value if it is a CSS custom property
  42428. // since they are user-defined.
  42429. if (!isCustomProp) {
  42430. name = finalPropName(origName);
  42431. }
  42432. // Gets hook for the prefixed version, then unprefixed version
  42433. hooks = jQuery.cssHooks[name] || jQuery.cssHooks[origName];
  42434. // Check if we're setting a value
  42435. if (value !== undefined) {
  42436. type = typeof value === "undefined" ? "undefined" : _typeof(value);
  42437. // Convert "+=" or "-=" to relative numbers (#7345)
  42438. if (type === "string" && (ret = rcssNum.exec(value)) && ret[1]) {
  42439. value = adjustCSS(elem, name, ret);
  42440. // Fixes bug #9237
  42441. type = "number";
  42442. }
  42443. // Make sure that null and NaN values aren't set (#7116)
  42444. if (value == null || value !== value) {
  42445. return;
  42446. }
  42447. // If a number was passed in, add the unit (except for certain CSS properties)
  42448. if (type === "number") {
  42449. value += ret && ret[3] || (jQuery.cssNumber[origName] ? "" : "px");
  42450. }
  42451. // background-* props affect original clone's values
  42452. if (!support.clearCloneStyle && value === "" && name.indexOf("background") === 0) {
  42453. style[name] = "inherit";
  42454. }
  42455. // If a hook was provided, use that value, otherwise just set the specified value
  42456. if (!hooks || !("set" in hooks) || (value = hooks.set(elem, value, extra)) !== undefined) {
  42457. if (isCustomProp) {
  42458. style.setProperty(name, value);
  42459. } else {
  42460. style[name] = value;
  42461. }
  42462. }
  42463. } else {
  42464. // If a hook was provided get the non-computed value from there
  42465. if (hooks && "get" in hooks && (ret = hooks.get(elem, false, extra)) !== undefined) {
  42466. return ret;
  42467. }
  42468. // Otherwise just get the value from the style object
  42469. return style[name];
  42470. }
  42471. },
  42472. css: function css(elem, name, extra, styles) {
  42473. var val,
  42474. num,
  42475. hooks,
  42476. origName = camelCase(name),
  42477. isCustomProp = rcustomProp.test(name);
  42478. // Make sure that we're working with the right name. We don't
  42479. // want to modify the value if it is a CSS custom property
  42480. // since they are user-defined.
  42481. if (!isCustomProp) {
  42482. name = finalPropName(origName);
  42483. }
  42484. // Try prefixed name followed by the unprefixed name
  42485. hooks = jQuery.cssHooks[name] || jQuery.cssHooks[origName];
  42486. // If a hook was provided get the computed value from there
  42487. if (hooks && "get" in hooks) {
  42488. val = hooks.get(elem, true, extra);
  42489. }
  42490. // Otherwise, if a way to get the computed value exists, use that
  42491. if (val === undefined) {
  42492. val = curCSS(elem, name, styles);
  42493. }
  42494. // Convert "normal" to computed value
  42495. if (val === "normal" && name in cssNormalTransform) {
  42496. val = cssNormalTransform[name];
  42497. }
  42498. // Make numeric if forced or a qualifier was provided and val looks numeric
  42499. if (extra === "" || extra) {
  42500. num = parseFloat(val);
  42501. return extra === true || isFinite(num) ? num || 0 : val;
  42502. }
  42503. return val;
  42504. }
  42505. });
  42506. jQuery.each(["height", "width"], function (i, dimension) {
  42507. jQuery.cssHooks[dimension] = {
  42508. get: function get(elem, computed, extra) {
  42509. if (computed) {
  42510. // Certain elements can have dimension info if we invisibly show them
  42511. // but it must have a current display style that would benefit
  42512. return rdisplayswap.test(jQuery.css(elem, "display")) && (
  42513. // Support: Safari 8+
  42514. // Table columns in Safari have non-zero offsetWidth & zero
  42515. // getBoundingClientRect().width unless display is changed.
  42516. // Support: IE <=11 only
  42517. // Running getBoundingClientRect on a disconnected node
  42518. // in IE throws an error.
  42519. !elem.getClientRects().length || !elem.getBoundingClientRect().width) ? swap(elem, cssShow, function () {
  42520. return getWidthOrHeight(elem, dimension, extra);
  42521. }) : getWidthOrHeight(elem, dimension, extra);
  42522. }
  42523. },
  42524. set: function set(elem, value, extra) {
  42525. var matches,
  42526. styles = getStyles(elem),
  42527. isBorderBox = jQuery.css(elem, "boxSizing", false, styles) === "border-box",
  42528. subtract = extra && boxModelAdjustment(elem, dimension, extra, isBorderBox, styles);
  42529. // Account for unreliable border-box dimensions by comparing offset* to computed and
  42530. // faking a content-box to get border and padding (gh-3699)
  42531. if (isBorderBox && support.scrollboxSize() === styles.position) {
  42532. subtract -= Math.ceil(elem["offset" + dimension[0].toUpperCase() + dimension.slice(1)] - parseFloat(styles[dimension]) - boxModelAdjustment(elem, dimension, "border", false, styles) - 0.5);
  42533. }
  42534. // Convert to pixels if value adjustment is needed
  42535. if (subtract && (matches = rcssNum.exec(value)) && (matches[3] || "px") !== "px") {
  42536. elem.style[dimension] = value;
  42537. value = jQuery.css(elem, dimension);
  42538. }
  42539. return setPositiveNumber(elem, value, subtract);
  42540. }
  42541. };
  42542. });
  42543. jQuery.cssHooks.marginLeft = addGetHookIf(support.reliableMarginLeft, function (elem, computed) {
  42544. if (computed) {
  42545. return (parseFloat(curCSS(elem, "marginLeft")) || elem.getBoundingClientRect().left - swap(elem, { marginLeft: 0 }, function () {
  42546. return elem.getBoundingClientRect().left;
  42547. })) + "px";
  42548. }
  42549. });
  42550. // These hooks are used by animate to expand properties
  42551. jQuery.each({
  42552. margin: "",
  42553. padding: "",
  42554. border: "Width"
  42555. }, function (prefix, suffix) {
  42556. jQuery.cssHooks[prefix + suffix] = {
  42557. expand: function expand(value) {
  42558. var i = 0,
  42559. expanded = {},
  42560. // Assumes a single number if not a string
  42561. parts = typeof value === "string" ? value.split(" ") : [value];
  42562. for (; i < 4; i++) {
  42563. expanded[prefix + cssExpand[i] + suffix] = parts[i] || parts[i - 2] || parts[0];
  42564. }
  42565. return expanded;
  42566. }
  42567. };
  42568. if (prefix !== "margin") {
  42569. jQuery.cssHooks[prefix + suffix].set = setPositiveNumber;
  42570. }
  42571. });
  42572. jQuery.fn.extend({
  42573. css: function css(name, value) {
  42574. return access(this, function (elem, name, value) {
  42575. var styles,
  42576. len,
  42577. map = {},
  42578. i = 0;
  42579. if (Array.isArray(name)) {
  42580. styles = getStyles(elem);
  42581. len = name.length;
  42582. for (; i < len; i++) {
  42583. map[name[i]] = jQuery.css(elem, name[i], false, styles);
  42584. }
  42585. return map;
  42586. }
  42587. return value !== undefined ? jQuery.style(elem, name, value) : jQuery.css(elem, name);
  42588. }, name, value, arguments.length > 1);
  42589. }
  42590. });
  42591. function Tween(elem, options, prop, end, easing) {
  42592. return new Tween.prototype.init(elem, options, prop, end, easing);
  42593. }
  42594. jQuery.Tween = Tween;
  42595. Tween.prototype = {
  42596. constructor: Tween,
  42597. init: function init(elem, options, prop, end, easing, unit) {
  42598. this.elem = elem;
  42599. this.prop = prop;
  42600. this.easing = easing || jQuery.easing._default;
  42601. this.options = options;
  42602. this.start = this.now = this.cur();
  42603. this.end = end;
  42604. this.unit = unit || (jQuery.cssNumber[prop] ? "" : "px");
  42605. },
  42606. cur: function cur() {
  42607. var hooks = Tween.propHooks[this.prop];
  42608. return hooks && hooks.get ? hooks.get(this) : Tween.propHooks._default.get(this);
  42609. },
  42610. run: function run(percent) {
  42611. var eased,
  42612. hooks = Tween.propHooks[this.prop];
  42613. if (this.options.duration) {
  42614. this.pos = eased = jQuery.easing[this.easing](percent, this.options.duration * percent, 0, 1, this.options.duration);
  42615. } else {
  42616. this.pos = eased = percent;
  42617. }
  42618. this.now = (this.end - this.start) * eased + this.start;
  42619. if (this.options.step) {
  42620. this.options.step.call(this.elem, this.now, this);
  42621. }
  42622. if (hooks && hooks.set) {
  42623. hooks.set(this);
  42624. } else {
  42625. Tween.propHooks._default.set(this);
  42626. }
  42627. return this;
  42628. }
  42629. };
  42630. Tween.prototype.init.prototype = Tween.prototype;
  42631. Tween.propHooks = {
  42632. _default: {
  42633. get: function get(tween) {
  42634. var result;
  42635. // Use a property on the element directly when it is not a DOM element,
  42636. // or when there is no matching style property that exists.
  42637. if (tween.elem.nodeType !== 1 || tween.elem[tween.prop] != null && tween.elem.style[tween.prop] == null) {
  42638. return tween.elem[tween.prop];
  42639. }
  42640. // Passing an empty string as a 3rd parameter to .css will automatically
  42641. // attempt a parseFloat and fallback to a string if the parse fails.
  42642. // Simple values such as "10px" are parsed to Float;
  42643. // complex values such as "rotate(1rad)" are returned as-is.
  42644. result = jQuery.css(tween.elem, tween.prop, "");
  42645. // Empty strings, null, undefined and "auto" are converted to 0.
  42646. return !result || result === "auto" ? 0 : result;
  42647. },
  42648. set: function set(tween) {
  42649. // Use step hook for back compat.
  42650. // Use cssHook if its there.
  42651. // Use .style if available and use plain properties where available.
  42652. if (jQuery.fx.step[tween.prop]) {
  42653. jQuery.fx.step[tween.prop](tween);
  42654. } else if (tween.elem.nodeType === 1 && (tween.elem.style[jQuery.cssProps[tween.prop]] != null || jQuery.cssHooks[tween.prop])) {
  42655. jQuery.style(tween.elem, tween.prop, tween.now + tween.unit);
  42656. } else {
  42657. tween.elem[tween.prop] = tween.now;
  42658. }
  42659. }
  42660. }
  42661. };
  42662. // Support: IE <=9 only
  42663. // Panic based approach to setting things on disconnected nodes
  42664. Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = {
  42665. set: function set(tween) {
  42666. if (tween.elem.nodeType && tween.elem.parentNode) {
  42667. tween.elem[tween.prop] = tween.now;
  42668. }
  42669. }
  42670. };
  42671. jQuery.easing = {
  42672. linear: function linear(p) {
  42673. return p;
  42674. },
  42675. swing: function swing(p) {
  42676. return 0.5 - Math.cos(p * Math.PI) / 2;
  42677. },
  42678. _default: "swing"
  42679. };
  42680. jQuery.fx = Tween.prototype.init;
  42681. // Back compat <1.8 extension point
  42682. jQuery.fx.step = {};
  42683. var fxNow,
  42684. inProgress,
  42685. rfxtypes = /^(?:toggle|show|hide)$/,
  42686. rrun = /queueHooks$/;
  42687. function schedule() {
  42688. if (inProgress) {
  42689. if (document.hidden === false && window.requestAnimationFrame) {
  42690. window.requestAnimationFrame(schedule);
  42691. } else {
  42692. window.setTimeout(schedule, jQuery.fx.interval);
  42693. }
  42694. jQuery.fx.tick();
  42695. }
  42696. }
  42697. // Animations created synchronously will run synchronously
  42698. function createFxNow() {
  42699. window.setTimeout(function () {
  42700. fxNow = undefined;
  42701. });
  42702. return fxNow = Date.now();
  42703. }
  42704. // Generate parameters to create a standard animation
  42705. function genFx(type, includeWidth) {
  42706. var which,
  42707. i = 0,
  42708. attrs = { height: type };
  42709. // If we include width, step value is 1 to do all cssExpand values,
  42710. // otherwise step value is 2 to skip over Left and Right
  42711. includeWidth = includeWidth ? 1 : 0;
  42712. for (; i < 4; i += 2 - includeWidth) {
  42713. which = cssExpand[i];
  42714. attrs["margin" + which] = attrs["padding" + which] = type;
  42715. }
  42716. if (includeWidth) {
  42717. attrs.opacity = attrs.width = type;
  42718. }
  42719. return attrs;
  42720. }
  42721. function createTween(value, prop, animation) {
  42722. var tween,
  42723. collection = (Animation.tweeners[prop] || []).concat(Animation.tweeners["*"]),
  42724. index = 0,
  42725. length = collection.length;
  42726. for (; index < length; index++) {
  42727. if (tween = collection[index].call(animation, prop, value)) {
  42728. // We're done with this property
  42729. return tween;
  42730. }
  42731. }
  42732. }
  42733. function defaultPrefilter(elem, props, opts) {
  42734. var prop,
  42735. value,
  42736. toggle,
  42737. hooks,
  42738. oldfire,
  42739. propTween,
  42740. restoreDisplay,
  42741. display,
  42742. isBox = "width" in props || "height" in props,
  42743. anim = this,
  42744. orig = {},
  42745. style = elem.style,
  42746. hidden = elem.nodeType && isHiddenWithinTree(elem),
  42747. dataShow = dataPriv.get(elem, "fxshow");
  42748. // Queue-skipping animations hijack the fx hooks
  42749. if (!opts.queue) {
  42750. hooks = jQuery._queueHooks(elem, "fx");
  42751. if (hooks.unqueued == null) {
  42752. hooks.unqueued = 0;
  42753. oldfire = hooks.empty.fire;
  42754. hooks.empty.fire = function () {
  42755. if (!hooks.unqueued) {
  42756. oldfire();
  42757. }
  42758. };
  42759. }
  42760. hooks.unqueued++;
  42761. anim.always(function () {
  42762. // Ensure the complete handler is called before this completes
  42763. anim.always(function () {
  42764. hooks.unqueued--;
  42765. if (!jQuery.queue(elem, "fx").length) {
  42766. hooks.empty.fire();
  42767. }
  42768. });
  42769. });
  42770. }
  42771. // Detect show/hide animations
  42772. for (prop in props) {
  42773. value = props[prop];
  42774. if (rfxtypes.test(value)) {
  42775. delete props[prop];
  42776. toggle = toggle || value === "toggle";
  42777. if (value === (hidden ? "hide" : "show")) {
  42778. // Pretend to be hidden if this is a "show" and
  42779. // there is still data from a stopped show/hide
  42780. if (value === "show" && dataShow && dataShow[prop] !== undefined) {
  42781. hidden = true;
  42782. // Ignore all other no-op show/hide data
  42783. } else {
  42784. continue;
  42785. }
  42786. }
  42787. orig[prop] = dataShow && dataShow[prop] || jQuery.style(elem, prop);
  42788. }
  42789. }
  42790. // Bail out if this is a no-op like .hide().hide()
  42791. propTween = !jQuery.isEmptyObject(props);
  42792. if (!propTween && jQuery.isEmptyObject(orig)) {
  42793. return;
  42794. }
  42795. // Restrict "overflow" and "display" styles during box animations
  42796. if (isBox && elem.nodeType === 1) {
  42797. // Support: IE <=9 - 11, Edge 12 - 15
  42798. // Record all 3 overflow attributes because IE does not infer the shorthand
  42799. // from identically-valued overflowX and overflowY and Edge just mirrors
  42800. // the overflowX value there.
  42801. opts.overflow = [style.overflow, style.overflowX, style.overflowY];
  42802. // Identify a display type, preferring old show/hide data over the CSS cascade
  42803. restoreDisplay = dataShow && dataShow.display;
  42804. if (restoreDisplay == null) {
  42805. restoreDisplay = dataPriv.get(elem, "display");
  42806. }
  42807. display = jQuery.css(elem, "display");
  42808. if (display === "none") {
  42809. if (restoreDisplay) {
  42810. display = restoreDisplay;
  42811. } else {
  42812. // Get nonempty value(s) by temporarily forcing visibility
  42813. showHide([elem], true);
  42814. restoreDisplay = elem.style.display || restoreDisplay;
  42815. display = jQuery.css(elem, "display");
  42816. showHide([elem]);
  42817. }
  42818. }
  42819. // Animate inline elements as inline-block
  42820. if (display === "inline" || display === "inline-block" && restoreDisplay != null) {
  42821. if (jQuery.css(elem, "float") === "none") {
  42822. // Restore the original display value at the end of pure show/hide animations
  42823. if (!propTween) {
  42824. anim.done(function () {
  42825. style.display = restoreDisplay;
  42826. });
  42827. if (restoreDisplay == null) {
  42828. display = style.display;
  42829. restoreDisplay = display === "none" ? "" : display;
  42830. }
  42831. }
  42832. style.display = "inline-block";
  42833. }
  42834. }
  42835. }
  42836. if (opts.overflow) {
  42837. style.overflow = "hidden";
  42838. anim.always(function () {
  42839. style.overflow = opts.overflow[0];
  42840. style.overflowX = opts.overflow[1];
  42841. style.overflowY = opts.overflow[2];
  42842. });
  42843. }
  42844. // Implement show/hide animations
  42845. propTween = false;
  42846. for (prop in orig) {
  42847. // General show/hide setup for this element animation
  42848. if (!propTween) {
  42849. if (dataShow) {
  42850. if ("hidden" in dataShow) {
  42851. hidden = dataShow.hidden;
  42852. }
  42853. } else {
  42854. dataShow = dataPriv.access(elem, "fxshow", { display: restoreDisplay });
  42855. }
  42856. // Store hidden/visible for toggle so `.stop().toggle()` "reverses"
  42857. if (toggle) {
  42858. dataShow.hidden = !hidden;
  42859. }
  42860. // Show elements before animating them
  42861. if (hidden) {
  42862. showHide([elem], true);
  42863. }
  42864. /* eslint-disable no-loop-func */
  42865. anim.done(function () {
  42866. /* eslint-enable no-loop-func */
  42867. // The final step of a "hide" animation is actually hiding the element
  42868. if (!hidden) {
  42869. showHide([elem]);
  42870. }
  42871. dataPriv.remove(elem, "fxshow");
  42872. for (prop in orig) {
  42873. jQuery.style(elem, prop, orig[prop]);
  42874. }
  42875. });
  42876. }
  42877. // Per-property setup
  42878. propTween = createTween(hidden ? dataShow[prop] : 0, prop, anim);
  42879. if (!(prop in dataShow)) {
  42880. dataShow[prop] = propTween.start;
  42881. if (hidden) {
  42882. propTween.end = propTween.start;
  42883. propTween.start = 0;
  42884. }
  42885. }
  42886. }
  42887. }
  42888. function propFilter(props, specialEasing) {
  42889. var index, name, easing, value, hooks;
  42890. // camelCase, specialEasing and expand cssHook pass
  42891. for (index in props) {
  42892. name = camelCase(index);
  42893. easing = specialEasing[name];
  42894. value = props[index];
  42895. if (Array.isArray(value)) {
  42896. easing = value[1];
  42897. value = props[index] = value[0];
  42898. }
  42899. if (index !== name) {
  42900. props[name] = value;
  42901. delete props[index];
  42902. }
  42903. hooks = jQuery.cssHooks[name];
  42904. if (hooks && "expand" in hooks) {
  42905. value = hooks.expand(value);
  42906. delete props[name];
  42907. // Not quite $.extend, this won't overwrite existing keys.
  42908. // Reusing 'index' because we have the correct "name"
  42909. for (index in value) {
  42910. if (!(index in props)) {
  42911. props[index] = value[index];
  42912. specialEasing[index] = easing;
  42913. }
  42914. }
  42915. } else {
  42916. specialEasing[name] = easing;
  42917. }
  42918. }
  42919. }
  42920. function Animation(elem, properties, options) {
  42921. var result,
  42922. stopped,
  42923. index = 0,
  42924. length = Animation.prefilters.length,
  42925. deferred = jQuery.Deferred().always(function () {
  42926. // Don't match elem in the :animated selector
  42927. delete tick.elem;
  42928. }),
  42929. tick = function tick() {
  42930. if (stopped) {
  42931. return false;
  42932. }
  42933. var currentTime = fxNow || createFxNow(),
  42934. remaining = Math.max(0, animation.startTime + animation.duration - currentTime),
  42935. // Support: Android 2.3 only
  42936. // Archaic crash bug won't allow us to use `1 - ( 0.5 || 0 )` (#12497)
  42937. temp = remaining / animation.duration || 0,
  42938. percent = 1 - temp,
  42939. index = 0,
  42940. length = animation.tweens.length;
  42941. for (; index < length; index++) {
  42942. animation.tweens[index].run(percent);
  42943. }
  42944. deferred.notifyWith(elem, [animation, percent, remaining]);
  42945. // If there's more to do, yield
  42946. if (percent < 1 && length) {
  42947. return remaining;
  42948. }
  42949. // If this was an empty animation, synthesize a final progress notification
  42950. if (!length) {
  42951. deferred.notifyWith(elem, [animation, 1, 0]);
  42952. }
  42953. // Resolve the animation and report its conclusion
  42954. deferred.resolveWith(elem, [animation]);
  42955. return false;
  42956. },
  42957. animation = deferred.promise({
  42958. elem: elem,
  42959. props: jQuery.extend({}, properties),
  42960. opts: jQuery.extend(true, {
  42961. specialEasing: {},
  42962. easing: jQuery.easing._default
  42963. }, options),
  42964. originalProperties: properties,
  42965. originalOptions: options,
  42966. startTime: fxNow || createFxNow(),
  42967. duration: options.duration,
  42968. tweens: [],
  42969. createTween: function createTween(prop, end) {
  42970. var tween = jQuery.Tween(elem, animation.opts, prop, end, animation.opts.specialEasing[prop] || animation.opts.easing);
  42971. animation.tweens.push(tween);
  42972. return tween;
  42973. },
  42974. stop: function stop(gotoEnd) {
  42975. var index = 0,
  42976. // If we are going to the end, we want to run all the tweens
  42977. // otherwise we skip this part
  42978. length = gotoEnd ? animation.tweens.length : 0;
  42979. if (stopped) {
  42980. return this;
  42981. }
  42982. stopped = true;
  42983. for (; index < length; index++) {
  42984. animation.tweens[index].run(1);
  42985. }
  42986. // Resolve when we played the last frame; otherwise, reject
  42987. if (gotoEnd) {
  42988. deferred.notifyWith(elem, [animation, 1, 0]);
  42989. deferred.resolveWith(elem, [animation, gotoEnd]);
  42990. } else {
  42991. deferred.rejectWith(elem, [animation, gotoEnd]);
  42992. }
  42993. return this;
  42994. }
  42995. }),
  42996. props = animation.props;
  42997. propFilter(props, animation.opts.specialEasing);
  42998. for (; index < length; index++) {
  42999. result = Animation.prefilters[index].call(animation, elem, props, animation.opts);
  43000. if (result) {
  43001. if (isFunction(result.stop)) {
  43002. jQuery._queueHooks(animation.elem, animation.opts.queue).stop = result.stop.bind(result);
  43003. }
  43004. return result;
  43005. }
  43006. }
  43007. jQuery.map(props, createTween, animation);
  43008. if (isFunction(animation.opts.start)) {
  43009. animation.opts.start.call(elem, animation);
  43010. }
  43011. // Attach callbacks from options
  43012. animation.progress(animation.opts.progress).done(animation.opts.done, animation.opts.complete).fail(animation.opts.fail).always(animation.opts.always);
  43013. jQuery.fx.timer(jQuery.extend(tick, {
  43014. elem: elem,
  43015. anim: animation,
  43016. queue: animation.opts.queue
  43017. }));
  43018. return animation;
  43019. }
  43020. jQuery.Animation = jQuery.extend(Animation, {
  43021. tweeners: {
  43022. "*": [function (prop, value) {
  43023. var tween = this.createTween(prop, value);
  43024. adjustCSS(tween.elem, prop, rcssNum.exec(value), tween);
  43025. return tween;
  43026. }]
  43027. },
  43028. tweener: function tweener(props, callback) {
  43029. if (isFunction(props)) {
  43030. callback = props;
  43031. props = ["*"];
  43032. } else {
  43033. props = props.match(rnothtmlwhite);
  43034. }
  43035. var prop,
  43036. index = 0,
  43037. length = props.length;
  43038. for (; index < length; index++) {
  43039. prop = props[index];
  43040. Animation.tweeners[prop] = Animation.tweeners[prop] || [];
  43041. Animation.tweeners[prop].unshift(callback);
  43042. }
  43043. },
  43044. prefilters: [defaultPrefilter],
  43045. prefilter: function prefilter(callback, prepend) {
  43046. if (prepend) {
  43047. Animation.prefilters.unshift(callback);
  43048. } else {
  43049. Animation.prefilters.push(callback);
  43050. }
  43051. }
  43052. });
  43053. jQuery.speed = function (speed, easing, fn) {
  43054. var opt = speed && (typeof speed === "undefined" ? "undefined" : _typeof(speed)) === "object" ? jQuery.extend({}, speed) : {
  43055. complete: fn || !fn && easing || isFunction(speed) && speed,
  43056. duration: speed,
  43057. easing: fn && easing || easing && !isFunction(easing) && easing
  43058. };
  43059. // Go to the end state if fx are off
  43060. if (jQuery.fx.off) {
  43061. opt.duration = 0;
  43062. } else {
  43063. if (typeof opt.duration !== "number") {
  43064. if (opt.duration in jQuery.fx.speeds) {
  43065. opt.duration = jQuery.fx.speeds[opt.duration];
  43066. } else {
  43067. opt.duration = jQuery.fx.speeds._default;
  43068. }
  43069. }
  43070. }
  43071. // Normalize opt.queue - true/undefined/null -> "fx"
  43072. if (opt.queue == null || opt.queue === true) {
  43073. opt.queue = "fx";
  43074. }
  43075. // Queueing
  43076. opt.old = opt.complete;
  43077. opt.complete = function () {
  43078. if (isFunction(opt.old)) {
  43079. opt.old.call(this);
  43080. }
  43081. if (opt.queue) {
  43082. jQuery.dequeue(this, opt.queue);
  43083. }
  43084. };
  43085. return opt;
  43086. };
  43087. jQuery.fn.extend({
  43088. fadeTo: function fadeTo(speed, to, easing, callback) {
  43089. // Show any hidden elements after setting opacity to 0
  43090. return this.filter(isHiddenWithinTree).css("opacity", 0).show()
  43091. // Animate to the value specified
  43092. .end().animate({ opacity: to }, speed, easing, callback);
  43093. },
  43094. animate: function animate(prop, speed, easing, callback) {
  43095. var empty = jQuery.isEmptyObject(prop),
  43096. optall = jQuery.speed(speed, easing, callback),
  43097. doAnimation = function doAnimation() {
  43098. // Operate on a copy of prop so per-property easing won't be lost
  43099. var anim = Animation(this, jQuery.extend({}, prop), optall);
  43100. // Empty animations, or finishing resolves immediately
  43101. if (empty || dataPriv.get(this, "finish")) {
  43102. anim.stop(true);
  43103. }
  43104. };
  43105. doAnimation.finish = doAnimation;
  43106. return empty || optall.queue === false ? this.each(doAnimation) : this.queue(optall.queue, doAnimation);
  43107. },
  43108. stop: function stop(type, clearQueue, gotoEnd) {
  43109. var stopQueue = function stopQueue(hooks) {
  43110. var stop = hooks.stop;
  43111. delete hooks.stop;
  43112. stop(gotoEnd);
  43113. };
  43114. if (typeof type !== "string") {
  43115. gotoEnd = clearQueue;
  43116. clearQueue = type;
  43117. type = undefined;
  43118. }
  43119. if (clearQueue && type !== false) {
  43120. this.queue(type || "fx", []);
  43121. }
  43122. return this.each(function () {
  43123. var dequeue = true,
  43124. index = type != null && type + "queueHooks",
  43125. timers = jQuery.timers,
  43126. data = dataPriv.get(this);
  43127. if (index) {
  43128. if (data[index] && data[index].stop) {
  43129. stopQueue(data[index]);
  43130. }
  43131. } else {
  43132. for (index in data) {
  43133. if (data[index] && data[index].stop && rrun.test(index)) {
  43134. stopQueue(data[index]);
  43135. }
  43136. }
  43137. }
  43138. for (index = timers.length; index--;) {
  43139. if (timers[index].elem === this && (type == null || timers[index].queue === type)) {
  43140. timers[index].anim.stop(gotoEnd);
  43141. dequeue = false;
  43142. timers.splice(index, 1);
  43143. }
  43144. }
  43145. // Start the next in the queue if the last step wasn't forced.
  43146. // Timers currently will call their complete callbacks, which
  43147. // will dequeue but only if they were gotoEnd.
  43148. if (dequeue || !gotoEnd) {
  43149. jQuery.dequeue(this, type);
  43150. }
  43151. });
  43152. },
  43153. finish: function finish(type) {
  43154. if (type !== false) {
  43155. type = type || "fx";
  43156. }
  43157. return this.each(function () {
  43158. var index,
  43159. data = dataPriv.get(this),
  43160. queue = data[type + "queue"],
  43161. hooks = data[type + "queueHooks"],
  43162. timers = jQuery.timers,
  43163. length = queue ? queue.length : 0;
  43164. // Enable finishing flag on private data
  43165. data.finish = true;
  43166. // Empty the queue first
  43167. jQuery.queue(this, type, []);
  43168. if (hooks && hooks.stop) {
  43169. hooks.stop.call(this, true);
  43170. }
  43171. // Look for any active animations, and finish them
  43172. for (index = timers.length; index--;) {
  43173. if (timers[index].elem === this && timers[index].queue === type) {
  43174. timers[index].anim.stop(true);
  43175. timers.splice(index, 1);
  43176. }
  43177. }
  43178. // Look for any animations in the old queue and finish them
  43179. for (index = 0; index < length; index++) {
  43180. if (queue[index] && queue[index].finish) {
  43181. queue[index].finish.call(this);
  43182. }
  43183. }
  43184. // Turn off finishing flag
  43185. delete data.finish;
  43186. });
  43187. }
  43188. });
  43189. jQuery.each(["toggle", "show", "hide"], function (i, name) {
  43190. var cssFn = jQuery.fn[name];
  43191. jQuery.fn[name] = function (speed, easing, callback) {
  43192. return speed == null || typeof speed === "boolean" ? cssFn.apply(this, arguments) : this.animate(genFx(name, true), speed, easing, callback);
  43193. };
  43194. });
  43195. // Generate shortcuts for custom animations
  43196. jQuery.each({
  43197. slideDown: genFx("show"),
  43198. slideUp: genFx("hide"),
  43199. slideToggle: genFx("toggle"),
  43200. fadeIn: { opacity: "show" },
  43201. fadeOut: { opacity: "hide" },
  43202. fadeToggle: { opacity: "toggle" }
  43203. }, function (name, props) {
  43204. jQuery.fn[name] = function (speed, easing, callback) {
  43205. return this.animate(props, speed, easing, callback);
  43206. };
  43207. });
  43208. jQuery.timers = [];
  43209. jQuery.fx.tick = function () {
  43210. var timer,
  43211. i = 0,
  43212. timers = jQuery.timers;
  43213. fxNow = Date.now();
  43214. for (; i < timers.length; i++) {
  43215. timer = timers[i];
  43216. // Run the timer and safely remove it when done (allowing for external removal)
  43217. if (!timer() && timers[i] === timer) {
  43218. timers.splice(i--, 1);
  43219. }
  43220. }
  43221. if (!timers.length) {
  43222. jQuery.fx.stop();
  43223. }
  43224. fxNow = undefined;
  43225. };
  43226. jQuery.fx.timer = function (timer) {
  43227. jQuery.timers.push(timer);
  43228. jQuery.fx.start();
  43229. };
  43230. jQuery.fx.interval = 13;
  43231. jQuery.fx.start = function () {
  43232. if (inProgress) {
  43233. return;
  43234. }
  43235. inProgress = true;
  43236. schedule();
  43237. };
  43238. jQuery.fx.stop = function () {
  43239. inProgress = null;
  43240. };
  43241. jQuery.fx.speeds = {
  43242. slow: 600,
  43243. fast: 200,
  43244. // Default speed
  43245. _default: 400
  43246. };
  43247. // Based off of the plugin by Clint Helfers, with permission.
  43248. // https://web.archive.org/web/20100324014747/http://blindsignals.com/index.php/2009/07/jquery-delay/
  43249. jQuery.fn.delay = function (time, type) {
  43250. time = jQuery.fx ? jQuery.fx.speeds[time] || time : time;
  43251. type = type || "fx";
  43252. return this.queue(type, function (next, hooks) {
  43253. var timeout = window.setTimeout(next, time);
  43254. hooks.stop = function () {
  43255. window.clearTimeout(timeout);
  43256. };
  43257. });
  43258. };
  43259. (function () {
  43260. var input = document.createElement("input"),
  43261. select = document.createElement("select"),
  43262. opt = select.appendChild(document.createElement("option"));
  43263. input.type = "checkbox";
  43264. // Support: Android <=4.3 only
  43265. // Default value for a checkbox should be "on"
  43266. support.checkOn = input.value !== "";
  43267. // Support: IE <=11 only
  43268. // Must access selectedIndex to make default options select
  43269. support.optSelected = opt.selected;
  43270. // Support: IE <=11 only
  43271. // An input loses its value after becoming a radio
  43272. input = document.createElement("input");
  43273. input.value = "t";
  43274. input.type = "radio";
  43275. support.radioValue = input.value === "t";
  43276. })();
  43277. var boolHook,
  43278. attrHandle = jQuery.expr.attrHandle;
  43279. jQuery.fn.extend({
  43280. attr: function attr(name, value) {
  43281. return access(this, jQuery.attr, name, value, arguments.length > 1);
  43282. },
  43283. removeAttr: function removeAttr(name) {
  43284. return this.each(function () {
  43285. jQuery.removeAttr(this, name);
  43286. });
  43287. }
  43288. });
  43289. jQuery.extend({
  43290. attr: function attr(elem, name, value) {
  43291. var ret,
  43292. hooks,
  43293. nType = elem.nodeType;
  43294. // Don't get/set attributes on text, comment and attribute nodes
  43295. if (nType === 3 || nType === 8 || nType === 2) {
  43296. return;
  43297. }
  43298. // Fallback to prop when attributes are not supported
  43299. if (typeof elem.getAttribute === "undefined") {
  43300. return jQuery.prop(elem, name, value);
  43301. }
  43302. // Attribute hooks are determined by the lowercase version
  43303. // Grab necessary hook if one is defined
  43304. if (nType !== 1 || !jQuery.isXMLDoc(elem)) {
  43305. hooks = jQuery.attrHooks[name.toLowerCase()] || (jQuery.expr.match.bool.test(name) ? boolHook : undefined);
  43306. }
  43307. if (value !== undefined) {
  43308. if (value === null) {
  43309. jQuery.removeAttr(elem, name);
  43310. return;
  43311. }
  43312. if (hooks && "set" in hooks && (ret = hooks.set(elem, value, name)) !== undefined) {
  43313. return ret;
  43314. }
  43315. elem.setAttribute(name, value + "");
  43316. return value;
  43317. }
  43318. if (hooks && "get" in hooks && (ret = hooks.get(elem, name)) !== null) {
  43319. return ret;
  43320. }
  43321. ret = jQuery.find.attr(elem, name);
  43322. // Non-existent attributes return null, we normalize to undefined
  43323. return ret == null ? undefined : ret;
  43324. },
  43325. attrHooks: {
  43326. type: {
  43327. set: function set(elem, value) {
  43328. if (!support.radioValue && value === "radio" && nodeName(elem, "input")) {
  43329. var val = elem.value;
  43330. elem.setAttribute("type", value);
  43331. if (val) {
  43332. elem.value = val;
  43333. }
  43334. return value;
  43335. }
  43336. }
  43337. }
  43338. },
  43339. removeAttr: function removeAttr(elem, value) {
  43340. var name,
  43341. i = 0,
  43342. // Attribute names can contain non-HTML whitespace characters
  43343. // https://html.spec.whatwg.org/multipage/syntax.html#attributes-2
  43344. attrNames = value && value.match(rnothtmlwhite);
  43345. if (attrNames && elem.nodeType === 1) {
  43346. while (name = attrNames[i++]) {
  43347. elem.removeAttribute(name);
  43348. }
  43349. }
  43350. }
  43351. });
  43352. // Hooks for boolean attributes
  43353. boolHook = {
  43354. set: function set(elem, value, name) {
  43355. if (value === false) {
  43356. // Remove boolean attributes when set to false
  43357. jQuery.removeAttr(elem, name);
  43358. } else {
  43359. elem.setAttribute(name, name);
  43360. }
  43361. return name;
  43362. }
  43363. };
  43364. jQuery.each(jQuery.expr.match.bool.source.match(/\w+/g), function (i, name) {
  43365. var getter = attrHandle[name] || jQuery.find.attr;
  43366. attrHandle[name] = function (elem, name, isXML) {
  43367. var ret,
  43368. handle,
  43369. lowercaseName = name.toLowerCase();
  43370. if (!isXML) {
  43371. // Avoid an infinite loop by temporarily removing this function from the getter
  43372. handle = attrHandle[lowercaseName];
  43373. attrHandle[lowercaseName] = ret;
  43374. ret = getter(elem, name, isXML) != null ? lowercaseName : null;
  43375. attrHandle[lowercaseName] = handle;
  43376. }
  43377. return ret;
  43378. };
  43379. });
  43380. var rfocusable = /^(?:input|select|textarea|button)$/i,
  43381. rclickable = /^(?:a|area)$/i;
  43382. jQuery.fn.extend({
  43383. prop: function prop(name, value) {
  43384. return access(this, jQuery.prop, name, value, arguments.length > 1);
  43385. },
  43386. removeProp: function removeProp(name) {
  43387. return this.each(function () {
  43388. delete this[jQuery.propFix[name] || name];
  43389. });
  43390. }
  43391. });
  43392. jQuery.extend({
  43393. prop: function prop(elem, name, value) {
  43394. var ret,
  43395. hooks,
  43396. nType = elem.nodeType;
  43397. // Don't get/set properties on text, comment and attribute nodes
  43398. if (nType === 3 || nType === 8 || nType === 2) {
  43399. return;
  43400. }
  43401. if (nType !== 1 || !jQuery.isXMLDoc(elem)) {
  43402. // Fix name and attach hooks
  43403. name = jQuery.propFix[name] || name;
  43404. hooks = jQuery.propHooks[name];
  43405. }
  43406. if (value !== undefined) {
  43407. if (hooks && "set" in hooks && (ret = hooks.set(elem, value, name)) !== undefined) {
  43408. return ret;
  43409. }
  43410. return elem[name] = value;
  43411. }
  43412. if (hooks && "get" in hooks && (ret = hooks.get(elem, name)) !== null) {
  43413. return ret;
  43414. }
  43415. return elem[name];
  43416. },
  43417. propHooks: {
  43418. tabIndex: {
  43419. get: function get(elem) {
  43420. // Support: IE <=9 - 11 only
  43421. // elem.tabIndex doesn't always return the
  43422. // correct value when it hasn't been explicitly set
  43423. // https://web.archive.org/web/20141116233347/http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/
  43424. // Use proper attribute retrieval(#12072)
  43425. var tabindex = jQuery.find.attr(elem, "tabindex");
  43426. if (tabindex) {
  43427. return parseInt(tabindex, 10);
  43428. }
  43429. if (rfocusable.test(elem.nodeName) || rclickable.test(elem.nodeName) && elem.href) {
  43430. return 0;
  43431. }
  43432. return -1;
  43433. }
  43434. }
  43435. },
  43436. propFix: {
  43437. "for": "htmlFor",
  43438. "class": "className"
  43439. }
  43440. });
  43441. // Support: IE <=11 only
  43442. // Accessing the selectedIndex property
  43443. // forces the browser to respect setting selected
  43444. // on the option
  43445. // The getter ensures a default option is selected
  43446. // when in an optgroup
  43447. // eslint rule "no-unused-expressions" is disabled for this code
  43448. // since it considers such accessions noop
  43449. if (!support.optSelected) {
  43450. jQuery.propHooks.selected = {
  43451. get: function get(elem) {
  43452. /* eslint no-unused-expressions: "off" */
  43453. var parent = elem.parentNode;
  43454. if (parent && parent.parentNode) {
  43455. parent.parentNode.selectedIndex;
  43456. }
  43457. return null;
  43458. },
  43459. set: function set(elem) {
  43460. /* eslint no-unused-expressions: "off" */
  43461. var parent = elem.parentNode;
  43462. if (parent) {
  43463. parent.selectedIndex;
  43464. if (parent.parentNode) {
  43465. parent.parentNode.selectedIndex;
  43466. }
  43467. }
  43468. }
  43469. };
  43470. }
  43471. jQuery.each(["tabIndex", "readOnly", "maxLength", "cellSpacing", "cellPadding", "rowSpan", "colSpan", "useMap", "frameBorder", "contentEditable"], function () {
  43472. jQuery.propFix[this.toLowerCase()] = this;
  43473. });
  43474. // Strip and collapse whitespace according to HTML spec
  43475. // https://infra.spec.whatwg.org/#strip-and-collapse-ascii-whitespace
  43476. function stripAndCollapse(value) {
  43477. var tokens = value.match(rnothtmlwhite) || [];
  43478. return tokens.join(" ");
  43479. }
  43480. function getClass(elem) {
  43481. return elem.getAttribute && elem.getAttribute("class") || "";
  43482. }
  43483. function classesToArray(value) {
  43484. if (Array.isArray(value)) {
  43485. return value;
  43486. }
  43487. if (typeof value === "string") {
  43488. return value.match(rnothtmlwhite) || [];
  43489. }
  43490. return [];
  43491. }
  43492. jQuery.fn.extend({
  43493. addClass: function addClass(value) {
  43494. var classes,
  43495. elem,
  43496. cur,
  43497. curValue,
  43498. clazz,
  43499. j,
  43500. finalValue,
  43501. i = 0;
  43502. if (isFunction(value)) {
  43503. return this.each(function (j) {
  43504. jQuery(this).addClass(value.call(this, j, getClass(this)));
  43505. });
  43506. }
  43507. classes = classesToArray(value);
  43508. if (classes.length) {
  43509. while (elem = this[i++]) {
  43510. curValue = getClass(elem);
  43511. cur = elem.nodeType === 1 && " " + stripAndCollapse(curValue) + " ";
  43512. if (cur) {
  43513. j = 0;
  43514. while (clazz = classes[j++]) {
  43515. if (cur.indexOf(" " + clazz + " ") < 0) {
  43516. cur += clazz + " ";
  43517. }
  43518. }
  43519. // Only assign if different to avoid unneeded rendering.
  43520. finalValue = stripAndCollapse(cur);
  43521. if (curValue !== finalValue) {
  43522. elem.setAttribute("class", finalValue);
  43523. }
  43524. }
  43525. }
  43526. }
  43527. return this;
  43528. },
  43529. removeClass: function removeClass(value) {
  43530. var classes,
  43531. elem,
  43532. cur,
  43533. curValue,
  43534. clazz,
  43535. j,
  43536. finalValue,
  43537. i = 0;
  43538. if (isFunction(value)) {
  43539. return this.each(function (j) {
  43540. jQuery(this).removeClass(value.call(this, j, getClass(this)));
  43541. });
  43542. }
  43543. if (!arguments.length) {
  43544. return this.attr("class", "");
  43545. }
  43546. classes = classesToArray(value);
  43547. if (classes.length) {
  43548. while (elem = this[i++]) {
  43549. curValue = getClass(elem);
  43550. // This expression is here for better compressibility (see addClass)
  43551. cur = elem.nodeType === 1 && " " + stripAndCollapse(curValue) + " ";
  43552. if (cur) {
  43553. j = 0;
  43554. while (clazz = classes[j++]) {
  43555. // Remove *all* instances
  43556. while (cur.indexOf(" " + clazz + " ") > -1) {
  43557. cur = cur.replace(" " + clazz + " ", " ");
  43558. }
  43559. }
  43560. // Only assign if different to avoid unneeded rendering.
  43561. finalValue = stripAndCollapse(cur);
  43562. if (curValue !== finalValue) {
  43563. elem.setAttribute("class", finalValue);
  43564. }
  43565. }
  43566. }
  43567. }
  43568. return this;
  43569. },
  43570. toggleClass: function toggleClass(value, stateVal) {
  43571. var type = typeof value === "undefined" ? "undefined" : _typeof(value),
  43572. isValidValue = type === "string" || Array.isArray(value);
  43573. if (typeof stateVal === "boolean" && isValidValue) {
  43574. return stateVal ? this.addClass(value) : this.removeClass(value);
  43575. }
  43576. if (isFunction(value)) {
  43577. return this.each(function (i) {
  43578. jQuery(this).toggleClass(value.call(this, i, getClass(this), stateVal), stateVal);
  43579. });
  43580. }
  43581. return this.each(function () {
  43582. var className, i, self, classNames;
  43583. if (isValidValue) {
  43584. // Toggle individual class names
  43585. i = 0;
  43586. self = jQuery(this);
  43587. classNames = classesToArray(value);
  43588. while (className = classNames[i++]) {
  43589. // Check each className given, space separated list
  43590. if (self.hasClass(className)) {
  43591. self.removeClass(className);
  43592. } else {
  43593. self.addClass(className);
  43594. }
  43595. }
  43596. // Toggle whole class name
  43597. } else if (value === undefined || type === "boolean") {
  43598. className = getClass(this);
  43599. if (className) {
  43600. // Store className if set
  43601. dataPriv.set(this, "__className__", className);
  43602. }
  43603. // If the element has a class name or if we're passed `false`,
  43604. // then remove the whole classname (if there was one, the above saved it).
  43605. // Otherwise bring back whatever was previously saved (if anything),
  43606. // falling back to the empty string if nothing was stored.
  43607. if (this.setAttribute) {
  43608. this.setAttribute("class", className || value === false ? "" : dataPriv.get(this, "__className__") || "");
  43609. }
  43610. }
  43611. });
  43612. },
  43613. hasClass: function hasClass(selector) {
  43614. var className,
  43615. elem,
  43616. i = 0;
  43617. className = " " + selector + " ";
  43618. while (elem = this[i++]) {
  43619. if (elem.nodeType === 1 && (" " + stripAndCollapse(getClass(elem)) + " ").indexOf(className) > -1) {
  43620. return true;
  43621. }
  43622. }
  43623. return false;
  43624. }
  43625. });
  43626. var rreturn = /\r/g;
  43627. jQuery.fn.extend({
  43628. val: function val(value) {
  43629. var hooks,
  43630. ret,
  43631. valueIsFunction,
  43632. elem = this[0];
  43633. if (!arguments.length) {
  43634. if (elem) {
  43635. hooks = jQuery.valHooks[elem.type] || jQuery.valHooks[elem.nodeName.toLowerCase()];
  43636. if (hooks && "get" in hooks && (ret = hooks.get(elem, "value")) !== undefined) {
  43637. return ret;
  43638. }
  43639. ret = elem.value;
  43640. // Handle most common string cases
  43641. if (typeof ret === "string") {
  43642. return ret.replace(rreturn, "");
  43643. }
  43644. // Handle cases where value is null/undef or number
  43645. return ret == null ? "" : ret;
  43646. }
  43647. return;
  43648. }
  43649. valueIsFunction = isFunction(value);
  43650. return this.each(function (i) {
  43651. var val;
  43652. if (this.nodeType !== 1) {
  43653. return;
  43654. }
  43655. if (valueIsFunction) {
  43656. val = value.call(this, i, jQuery(this).val());
  43657. } else {
  43658. val = value;
  43659. }
  43660. // Treat null/undefined as ""; convert numbers to string
  43661. if (val == null) {
  43662. val = "";
  43663. } else if (typeof val === "number") {
  43664. val += "";
  43665. } else if (Array.isArray(val)) {
  43666. val = jQuery.map(val, function (value) {
  43667. return value == null ? "" : value + "";
  43668. });
  43669. }
  43670. hooks = jQuery.valHooks[this.type] || jQuery.valHooks[this.nodeName.toLowerCase()];
  43671. // If set returns undefined, fall back to normal setting
  43672. if (!hooks || !("set" in hooks) || hooks.set(this, val, "value") === undefined) {
  43673. this.value = val;
  43674. }
  43675. });
  43676. }
  43677. });
  43678. jQuery.extend({
  43679. valHooks: {
  43680. option: {
  43681. get: function get(elem) {
  43682. var val = jQuery.find.attr(elem, "value");
  43683. return val != null ? val :
  43684. // Support: IE <=10 - 11 only
  43685. // option.text throws exceptions (#14686, #14858)
  43686. // Strip and collapse whitespace
  43687. // https://html.spec.whatwg.org/#strip-and-collapse-whitespace
  43688. stripAndCollapse(jQuery.text(elem));
  43689. }
  43690. },
  43691. select: {
  43692. get: function get(elem) {
  43693. var value,
  43694. option,
  43695. i,
  43696. options = elem.options,
  43697. index = elem.selectedIndex,
  43698. one = elem.type === "select-one",
  43699. values = one ? null : [],
  43700. max = one ? index + 1 : options.length;
  43701. if (index < 0) {
  43702. i = max;
  43703. } else {
  43704. i = one ? index : 0;
  43705. }
  43706. // Loop through all the selected options
  43707. for (; i < max; i++) {
  43708. option = options[i];
  43709. // Support: IE <=9 only
  43710. // IE8-9 doesn't update selected after form reset (#2551)
  43711. if ((option.selected || i === index) &&
  43712. // Don't return options that are disabled or in a disabled optgroup
  43713. !option.disabled && (!option.parentNode.disabled || !nodeName(option.parentNode, "optgroup"))) {
  43714. // Get the specific value for the option
  43715. value = jQuery(option).val();
  43716. // We don't need an array for one selects
  43717. if (one) {
  43718. return value;
  43719. }
  43720. // Multi-Selects return an array
  43721. values.push(value);
  43722. }
  43723. }
  43724. return values;
  43725. },
  43726. set: function set(elem, value) {
  43727. var optionSet,
  43728. option,
  43729. options = elem.options,
  43730. values = jQuery.makeArray(value),
  43731. i = options.length;
  43732. while (i--) {
  43733. option = options[i];
  43734. /* eslint-disable no-cond-assign */
  43735. if (option.selected = jQuery.inArray(jQuery.valHooks.option.get(option), values) > -1) {
  43736. optionSet = true;
  43737. }
  43738. /* eslint-enable no-cond-assign */
  43739. }
  43740. // Force browsers to behave consistently when non-matching value is set
  43741. if (!optionSet) {
  43742. elem.selectedIndex = -1;
  43743. }
  43744. return values;
  43745. }
  43746. }
  43747. }
  43748. });
  43749. // Radios and checkboxes getter/setter
  43750. jQuery.each(["radio", "checkbox"], function () {
  43751. jQuery.valHooks[this] = {
  43752. set: function set(elem, value) {
  43753. if (Array.isArray(value)) {
  43754. return elem.checked = jQuery.inArray(jQuery(elem).val(), value) > -1;
  43755. }
  43756. }
  43757. };
  43758. if (!support.checkOn) {
  43759. jQuery.valHooks[this].get = function (elem) {
  43760. return elem.getAttribute("value") === null ? "on" : elem.value;
  43761. };
  43762. }
  43763. });
  43764. // Return jQuery for attributes-only inclusion
  43765. support.focusin = "onfocusin" in window;
  43766. var rfocusMorph = /^(?:focusinfocus|focusoutblur)$/,
  43767. stopPropagationCallback = function stopPropagationCallback(e) {
  43768. e.stopPropagation();
  43769. };
  43770. jQuery.extend(jQuery.event, {
  43771. trigger: function trigger(event, data, elem, onlyHandlers) {
  43772. var i,
  43773. cur,
  43774. tmp,
  43775. bubbleType,
  43776. ontype,
  43777. handle,
  43778. special,
  43779. lastElement,
  43780. eventPath = [elem || document],
  43781. type = hasOwn.call(event, "type") ? event.type : event,
  43782. namespaces = hasOwn.call(event, "namespace") ? event.namespace.split(".") : [];
  43783. cur = lastElement = tmp = elem = elem || document;
  43784. // Don't do events on text and comment nodes
  43785. if (elem.nodeType === 3 || elem.nodeType === 8) {
  43786. return;
  43787. }
  43788. // focus/blur morphs to focusin/out; ensure we're not firing them right now
  43789. if (rfocusMorph.test(type + jQuery.event.triggered)) {
  43790. return;
  43791. }
  43792. if (type.indexOf(".") > -1) {
  43793. // Namespaced trigger; create a regexp to match event type in handle()
  43794. namespaces = type.split(".");
  43795. type = namespaces.shift();
  43796. namespaces.sort();
  43797. }
  43798. ontype = type.indexOf(":") < 0 && "on" + type;
  43799. // Caller can pass in a jQuery.Event object, Object, or just an event type string
  43800. event = event[jQuery.expando] ? event : new jQuery.Event(type, (typeof event === "undefined" ? "undefined" : _typeof(event)) === "object" && event);
  43801. // Trigger bitmask: & 1 for native handlers; & 2 for jQuery (always true)
  43802. event.isTrigger = onlyHandlers ? 2 : 3;
  43803. event.namespace = namespaces.join(".");
  43804. event.rnamespace = event.namespace ? new RegExp("(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)") : null;
  43805. // Clean up the event in case it is being reused
  43806. event.result = undefined;
  43807. if (!event.target) {
  43808. event.target = elem;
  43809. }
  43810. // Clone any incoming data and prepend the event, creating the handler arg list
  43811. data = data == null ? [event] : jQuery.makeArray(data, [event]);
  43812. // Allow special events to draw outside the lines
  43813. special = jQuery.event.special[type] || {};
  43814. if (!onlyHandlers && special.trigger && special.trigger.apply(elem, data) === false) {
  43815. return;
  43816. }
  43817. // Determine event propagation path in advance, per W3C events spec (#9951)
  43818. // Bubble up to document, then to window; watch for a global ownerDocument var (#9724)
  43819. if (!onlyHandlers && !special.noBubble && !isWindow(elem)) {
  43820. bubbleType = special.delegateType || type;
  43821. if (!rfocusMorph.test(bubbleType + type)) {
  43822. cur = cur.parentNode;
  43823. }
  43824. for (; cur; cur = cur.parentNode) {
  43825. eventPath.push(cur);
  43826. tmp = cur;
  43827. }
  43828. // Only add window if we got to document (e.g., not plain obj or detached DOM)
  43829. if (tmp === (elem.ownerDocument || document)) {
  43830. eventPath.push(tmp.defaultView || tmp.parentWindow || window);
  43831. }
  43832. }
  43833. // Fire handlers on the event path
  43834. i = 0;
  43835. while ((cur = eventPath[i++]) && !event.isPropagationStopped()) {
  43836. lastElement = cur;
  43837. event.type = i > 1 ? bubbleType : special.bindType || type;
  43838. // jQuery handler
  43839. handle = (dataPriv.get(cur, "events") || {})[event.type] && dataPriv.get(cur, "handle");
  43840. if (handle) {
  43841. handle.apply(cur, data);
  43842. }
  43843. // Native handler
  43844. handle = ontype && cur[ontype];
  43845. if (handle && handle.apply && acceptData(cur)) {
  43846. event.result = handle.apply(cur, data);
  43847. if (event.result === false) {
  43848. event.preventDefault();
  43849. }
  43850. }
  43851. }
  43852. event.type = type;
  43853. // If nobody prevented the default action, do it now
  43854. if (!onlyHandlers && !event.isDefaultPrevented()) {
  43855. if ((!special._default || special._default.apply(eventPath.pop(), data) === false) && acceptData(elem)) {
  43856. // Call a native DOM method on the target with the same name as the event.
  43857. // Don't do default actions on window, that's where global variables be (#6170)
  43858. if (ontype && isFunction(elem[type]) && !isWindow(elem)) {
  43859. // Don't re-trigger an onFOO event when we call its FOO() method
  43860. tmp = elem[ontype];
  43861. if (tmp) {
  43862. elem[ontype] = null;
  43863. }
  43864. // Prevent re-triggering of the same event, since we already bubbled it above
  43865. jQuery.event.triggered = type;
  43866. if (event.isPropagationStopped()) {
  43867. lastElement.addEventListener(type, stopPropagationCallback);
  43868. }
  43869. elem[type]();
  43870. if (event.isPropagationStopped()) {
  43871. lastElement.removeEventListener(type, stopPropagationCallback);
  43872. }
  43873. jQuery.event.triggered = undefined;
  43874. if (tmp) {
  43875. elem[ontype] = tmp;
  43876. }
  43877. }
  43878. }
  43879. }
  43880. return event.result;
  43881. },
  43882. // Piggyback on a donor event to simulate a different one
  43883. // Used only for `focus(in | out)` events
  43884. simulate: function simulate(type, elem, event) {
  43885. var e = jQuery.extend(new jQuery.Event(), event, {
  43886. type: type,
  43887. isSimulated: true
  43888. });
  43889. jQuery.event.trigger(e, null, elem);
  43890. }
  43891. });
  43892. jQuery.fn.extend({
  43893. trigger: function trigger(type, data) {
  43894. return this.each(function () {
  43895. jQuery.event.trigger(type, data, this);
  43896. });
  43897. },
  43898. triggerHandler: function triggerHandler(type, data) {
  43899. var elem = this[0];
  43900. if (elem) {
  43901. return jQuery.event.trigger(type, data, elem, true);
  43902. }
  43903. }
  43904. });
  43905. // Support: Firefox <=44
  43906. // Firefox doesn't have focus(in | out) events
  43907. // Related ticket - https://bugzilla.mozilla.org/show_bug.cgi?id=687787
  43908. //
  43909. // Support: Chrome <=48 - 49, Safari <=9.0 - 9.1
  43910. // focus(in | out) events fire after focus & blur events,
  43911. // which is spec violation - http://www.w3.org/TR/DOM-Level-3-Events/#events-focusevent-event-order
  43912. // Related ticket - https://bugs.chromium.org/p/chromium/issues/detail?id=449857
  43913. if (!support.focusin) {
  43914. jQuery.each({ focus: "focusin", blur: "focusout" }, function (orig, fix) {
  43915. // Attach a single capturing handler on the document while someone wants focusin/focusout
  43916. var handler = function handler(event) {
  43917. jQuery.event.simulate(fix, event.target, jQuery.event.fix(event));
  43918. };
  43919. jQuery.event.special[fix] = {
  43920. setup: function setup() {
  43921. var doc = this.ownerDocument || this,
  43922. attaches = dataPriv.access(doc, fix);
  43923. if (!attaches) {
  43924. doc.addEventListener(orig, handler, true);
  43925. }
  43926. dataPriv.access(doc, fix, (attaches || 0) + 1);
  43927. },
  43928. teardown: function teardown() {
  43929. var doc = this.ownerDocument || this,
  43930. attaches = dataPriv.access(doc, fix) - 1;
  43931. if (!attaches) {
  43932. doc.removeEventListener(orig, handler, true);
  43933. dataPriv.remove(doc, fix);
  43934. } else {
  43935. dataPriv.access(doc, fix, attaches);
  43936. }
  43937. }
  43938. };
  43939. });
  43940. }
  43941. var location = window.location;
  43942. var nonce = Date.now();
  43943. var rquery = /\?/;
  43944. // Cross-browser xml parsing
  43945. jQuery.parseXML = function (data) {
  43946. var xml;
  43947. if (!data || typeof data !== "string") {
  43948. return null;
  43949. }
  43950. // Support: IE 9 - 11 only
  43951. // IE throws on parseFromString with invalid input.
  43952. try {
  43953. xml = new window.DOMParser().parseFromString(data, "text/xml");
  43954. } catch (e) {
  43955. xml = undefined;
  43956. }
  43957. if (!xml || xml.getElementsByTagName("parsererror").length) {
  43958. jQuery.error("Invalid XML: " + data);
  43959. }
  43960. return xml;
  43961. };
  43962. var rbracket = /\[\]$/,
  43963. rCRLF = /\r?\n/g,
  43964. rsubmitterTypes = /^(?:submit|button|image|reset|file)$/i,
  43965. rsubmittable = /^(?:input|select|textarea|keygen)/i;
  43966. function buildParams(prefix, obj, traditional, add) {
  43967. var name;
  43968. if (Array.isArray(obj)) {
  43969. // Serialize array item.
  43970. jQuery.each(obj, function (i, v) {
  43971. if (traditional || rbracket.test(prefix)) {
  43972. // Treat each array item as a scalar.
  43973. add(prefix, v);
  43974. } else {
  43975. // Item is non-scalar (array or object), encode its numeric index.
  43976. buildParams(prefix + "[" + ((typeof v === "undefined" ? "undefined" : _typeof(v)) === "object" && v != null ? i : "") + "]", v, traditional, add);
  43977. }
  43978. });
  43979. } else if (!traditional && toType(obj) === "object") {
  43980. // Serialize object item.
  43981. for (name in obj) {
  43982. buildParams(prefix + "[" + name + "]", obj[name], traditional, add);
  43983. }
  43984. } else {
  43985. // Serialize scalar item.
  43986. add(prefix, obj);
  43987. }
  43988. }
  43989. // Serialize an array of form elements or a set of
  43990. // key/values into a query string
  43991. jQuery.param = function (a, traditional) {
  43992. var prefix,
  43993. s = [],
  43994. add = function add(key, valueOrFunction) {
  43995. // If value is a function, invoke it and use its return value
  43996. var value = isFunction(valueOrFunction) ? valueOrFunction() : valueOrFunction;
  43997. s[s.length] = encodeURIComponent(key) + "=" + encodeURIComponent(value == null ? "" : value);
  43998. };
  43999. // If an array was passed in, assume that it is an array of form elements.
  44000. if (Array.isArray(a) || a.jquery && !jQuery.isPlainObject(a)) {
  44001. // Serialize the form elements
  44002. jQuery.each(a, function () {
  44003. add(this.name, this.value);
  44004. });
  44005. } else {
  44006. // If traditional, encode the "old" way (the way 1.3.2 or older
  44007. // did it), otherwise encode params recursively.
  44008. for (prefix in a) {
  44009. buildParams(prefix, a[prefix], traditional, add);
  44010. }
  44011. }
  44012. // Return the resulting serialization
  44013. return s.join("&");
  44014. };
  44015. jQuery.fn.extend({
  44016. serialize: function serialize() {
  44017. return jQuery.param(this.serializeArray());
  44018. },
  44019. serializeArray: function serializeArray() {
  44020. return this.map(function () {
  44021. // Can add propHook for "elements" to filter or add form elements
  44022. var elements = jQuery.prop(this, "elements");
  44023. return elements ? jQuery.makeArray(elements) : this;
  44024. }).filter(function () {
  44025. var type = this.type;
  44026. // Use .is( ":disabled" ) so that fieldset[disabled] works
  44027. return this.name && !jQuery(this).is(":disabled") && rsubmittable.test(this.nodeName) && !rsubmitterTypes.test(type) && (this.checked || !rcheckableType.test(type));
  44028. }).map(function (i, elem) {
  44029. var val = jQuery(this).val();
  44030. if (val == null) {
  44031. return null;
  44032. }
  44033. if (Array.isArray(val)) {
  44034. return jQuery.map(val, function (val) {
  44035. return { name: elem.name, value: val.replace(rCRLF, "\r\n") };
  44036. });
  44037. }
  44038. return { name: elem.name, value: val.replace(rCRLF, "\r\n") };
  44039. }).get();
  44040. }
  44041. });
  44042. var r20 = /%20/g,
  44043. rhash = /#.*$/,
  44044. rantiCache = /([?&])_=[^&]*/,
  44045. rheaders = /^(.*?):[ \t]*([^\r\n]*)$/mg,
  44046. // #7653, #8125, #8152: local protocol detection
  44047. rlocalProtocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/,
  44048. rnoContent = /^(?:GET|HEAD)$/,
  44049. rprotocol = /^\/\//,
  44050. /* Prefilters
  44051. * 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example)
  44052. * 2) These are called:
  44053. * - BEFORE asking for a transport
  44054. * - AFTER param serialization (s.data is a string if s.processData is true)
  44055. * 3) key is the dataType
  44056. * 4) the catchall symbol "*" can be used
  44057. * 5) execution will start with transport dataType and THEN continue down to "*" if needed
  44058. */
  44059. prefilters = {},
  44060. /* Transports bindings
  44061. * 1) key is the dataType
  44062. * 2) the catchall symbol "*" can be used
  44063. * 3) selection will start with transport dataType and THEN go to "*" if needed
  44064. */
  44065. transports = {},
  44066. // Avoid comment-prolog char sequence (#10098); must appease lint and evade compression
  44067. allTypes = "*/".concat("*"),
  44068. // Anchor tag for parsing the document origin
  44069. originAnchor = document.createElement("a");
  44070. originAnchor.href = location.href;
  44071. // Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport
  44072. function addToPrefiltersOrTransports(structure) {
  44073. // dataTypeExpression is optional and defaults to "*"
  44074. return function (dataTypeExpression, func) {
  44075. if (typeof dataTypeExpression !== "string") {
  44076. func = dataTypeExpression;
  44077. dataTypeExpression = "*";
  44078. }
  44079. var dataType,
  44080. i = 0,
  44081. dataTypes = dataTypeExpression.toLowerCase().match(rnothtmlwhite) || [];
  44082. if (isFunction(func)) {
  44083. // For each dataType in the dataTypeExpression
  44084. while (dataType = dataTypes[i++]) {
  44085. // Prepend if requested
  44086. if (dataType[0] === "+") {
  44087. dataType = dataType.slice(1) || "*";
  44088. (structure[dataType] = structure[dataType] || []).unshift(func);
  44089. // Otherwise append
  44090. } else {
  44091. (structure[dataType] = structure[dataType] || []).push(func);
  44092. }
  44093. }
  44094. }
  44095. };
  44096. }
  44097. // Base inspection function for prefilters and transports
  44098. function inspectPrefiltersOrTransports(structure, options, originalOptions, jqXHR) {
  44099. var inspected = {},
  44100. seekingTransport = structure === transports;
  44101. function inspect(dataType) {
  44102. var selected;
  44103. inspected[dataType] = true;
  44104. jQuery.each(structure[dataType] || [], function (_, prefilterOrFactory) {
  44105. var dataTypeOrTransport = prefilterOrFactory(options, originalOptions, jqXHR);
  44106. if (typeof dataTypeOrTransport === "string" && !seekingTransport && !inspected[dataTypeOrTransport]) {
  44107. options.dataTypes.unshift(dataTypeOrTransport);
  44108. inspect(dataTypeOrTransport);
  44109. return false;
  44110. } else if (seekingTransport) {
  44111. return !(selected = dataTypeOrTransport);
  44112. }
  44113. });
  44114. return selected;
  44115. }
  44116. return inspect(options.dataTypes[0]) || !inspected["*"] && inspect("*");
  44117. }
  44118. // A special extend for ajax options
  44119. // that takes "flat" options (not to be deep extended)
  44120. // Fixes #9887
  44121. function ajaxExtend(target, src) {
  44122. var key,
  44123. deep,
  44124. flatOptions = jQuery.ajaxSettings.flatOptions || {};
  44125. for (key in src) {
  44126. if (src[key] !== undefined) {
  44127. (flatOptions[key] ? target : deep || (deep = {}))[key] = src[key];
  44128. }
  44129. }
  44130. if (deep) {
  44131. jQuery.extend(true, target, deep);
  44132. }
  44133. return target;
  44134. }
  44135. /* Handles responses to an ajax request:
  44136. * - finds the right dataType (mediates between content-type and expected dataType)
  44137. * - returns the corresponding response
  44138. */
  44139. function ajaxHandleResponses(s, jqXHR, responses) {
  44140. var ct,
  44141. type,
  44142. finalDataType,
  44143. firstDataType,
  44144. contents = s.contents,
  44145. dataTypes = s.dataTypes;
  44146. // Remove auto dataType and get content-type in the process
  44147. while (dataTypes[0] === "*") {
  44148. dataTypes.shift();
  44149. if (ct === undefined) {
  44150. ct = s.mimeType || jqXHR.getResponseHeader("Content-Type");
  44151. }
  44152. }
  44153. // Check if we're dealing with a known content-type
  44154. if (ct) {
  44155. for (type in contents) {
  44156. if (contents[type] && contents[type].test(ct)) {
  44157. dataTypes.unshift(type);
  44158. break;
  44159. }
  44160. }
  44161. }
  44162. // Check to see if we have a response for the expected dataType
  44163. if (dataTypes[0] in responses) {
  44164. finalDataType = dataTypes[0];
  44165. } else {
  44166. // Try convertible dataTypes
  44167. for (type in responses) {
  44168. if (!dataTypes[0] || s.converters[type + " " + dataTypes[0]]) {
  44169. finalDataType = type;
  44170. break;
  44171. }
  44172. if (!firstDataType) {
  44173. firstDataType = type;
  44174. }
  44175. }
  44176. // Or just use first one
  44177. finalDataType = finalDataType || firstDataType;
  44178. }
  44179. // If we found a dataType
  44180. // We add the dataType to the list if needed
  44181. // and return the corresponding response
  44182. if (finalDataType) {
  44183. if (finalDataType !== dataTypes[0]) {
  44184. dataTypes.unshift(finalDataType);
  44185. }
  44186. return responses[finalDataType];
  44187. }
  44188. }
  44189. /* Chain conversions given the request and the original response
  44190. * Also sets the responseXXX fields on the jqXHR instance
  44191. */
  44192. function ajaxConvert(s, response, jqXHR, isSuccess) {
  44193. var conv2,
  44194. current,
  44195. conv,
  44196. tmp,
  44197. prev,
  44198. converters = {},
  44199. // Work with a copy of dataTypes in case we need to modify it for conversion
  44200. dataTypes = s.dataTypes.slice();
  44201. // Create converters map with lowercased keys
  44202. if (dataTypes[1]) {
  44203. for (conv in s.converters) {
  44204. converters[conv.toLowerCase()] = s.converters[conv];
  44205. }
  44206. }
  44207. current = dataTypes.shift();
  44208. // Convert to each sequential dataType
  44209. while (current) {
  44210. if (s.responseFields[current]) {
  44211. jqXHR[s.responseFields[current]] = response;
  44212. }
  44213. // Apply the dataFilter if provided
  44214. if (!prev && isSuccess && s.dataFilter) {
  44215. response = s.dataFilter(response, s.dataType);
  44216. }
  44217. prev = current;
  44218. current = dataTypes.shift();
  44219. if (current) {
  44220. // There's only work to do if current dataType is non-auto
  44221. if (current === "*") {
  44222. current = prev;
  44223. // Convert response if prev dataType is non-auto and differs from current
  44224. } else if (prev !== "*" && prev !== current) {
  44225. // Seek a direct converter
  44226. conv = converters[prev + " " + current] || converters["* " + current];
  44227. // If none found, seek a pair
  44228. if (!conv) {
  44229. for (conv2 in converters) {
  44230. // If conv2 outputs current
  44231. tmp = conv2.split(" ");
  44232. if (tmp[1] === current) {
  44233. // If prev can be converted to accepted input
  44234. conv = converters[prev + " " + tmp[0]] || converters["* " + tmp[0]];
  44235. if (conv) {
  44236. // Condense equivalence converters
  44237. if (conv === true) {
  44238. conv = converters[conv2];
  44239. // Otherwise, insert the intermediate dataType
  44240. } else if (converters[conv2] !== true) {
  44241. current = tmp[0];
  44242. dataTypes.unshift(tmp[1]);
  44243. }
  44244. break;
  44245. }
  44246. }
  44247. }
  44248. }
  44249. // Apply converter (if not an equivalence)
  44250. if (conv !== true) {
  44251. // Unless errors are allowed to bubble, catch and return them
  44252. if (conv && s.throws) {
  44253. response = conv(response);
  44254. } else {
  44255. try {
  44256. response = conv(response);
  44257. } catch (e) {
  44258. return {
  44259. state: "parsererror",
  44260. error: conv ? e : "No conversion from " + prev + " to " + current
  44261. };
  44262. }
  44263. }
  44264. }
  44265. }
  44266. }
  44267. }
  44268. return { state: "success", data: response };
  44269. }
  44270. jQuery.extend({
  44271. // Counter for holding the number of active queries
  44272. active: 0,
  44273. // Last-Modified header cache for next request
  44274. lastModified: {},
  44275. etag: {},
  44276. ajaxSettings: {
  44277. url: location.href,
  44278. type: "GET",
  44279. isLocal: rlocalProtocol.test(location.protocol),
  44280. global: true,
  44281. processData: true,
  44282. async: true,
  44283. contentType: "application/x-www-form-urlencoded; charset=UTF-8",
  44284. /*
  44285. timeout: 0,
  44286. data: null,
  44287. dataType: null,
  44288. username: null,
  44289. password: null,
  44290. cache: null,
  44291. throws: false,
  44292. traditional: false,
  44293. headers: {},
  44294. */
  44295. accepts: {
  44296. "*": allTypes,
  44297. text: "text/plain",
  44298. html: "text/html",
  44299. xml: "application/xml, text/xml",
  44300. json: "application/json, text/javascript"
  44301. },
  44302. contents: {
  44303. xml: /\bxml\b/,
  44304. html: /\bhtml/,
  44305. json: /\bjson\b/
  44306. },
  44307. responseFields: {
  44308. xml: "responseXML",
  44309. text: "responseText",
  44310. json: "responseJSON"
  44311. },
  44312. // Data converters
  44313. // Keys separate source (or catchall "*") and destination types with a single space
  44314. converters: {
  44315. // Convert anything to text
  44316. "* text": String,
  44317. // Text to html (true = no transformation)
  44318. "text html": true,
  44319. // Evaluate text as a json expression
  44320. "text json": JSON.parse,
  44321. // Parse text as xml
  44322. "text xml": jQuery.parseXML
  44323. },
  44324. // For options that shouldn't be deep extended:
  44325. // you can add your own custom options here if
  44326. // and when you create one that shouldn't be
  44327. // deep extended (see ajaxExtend)
  44328. flatOptions: {
  44329. url: true,
  44330. context: true
  44331. }
  44332. },
  44333. // Creates a full fledged settings object into target
  44334. // with both ajaxSettings and settings fields.
  44335. // If target is omitted, writes into ajaxSettings.
  44336. ajaxSetup: function ajaxSetup(target, settings) {
  44337. return settings ?
  44338. // Building a settings object
  44339. ajaxExtend(ajaxExtend(target, jQuery.ajaxSettings), settings) :
  44340. // Extending ajaxSettings
  44341. ajaxExtend(jQuery.ajaxSettings, target);
  44342. },
  44343. ajaxPrefilter: addToPrefiltersOrTransports(prefilters),
  44344. ajaxTransport: addToPrefiltersOrTransports(transports),
  44345. // Main method
  44346. ajax: function ajax(url, options) {
  44347. // If url is an object, simulate pre-1.5 signature
  44348. if ((typeof url === "undefined" ? "undefined" : _typeof(url)) === "object") {
  44349. options = url;
  44350. url = undefined;
  44351. }
  44352. // Force options to be an object
  44353. options = options || {};
  44354. var transport,
  44355. // URL without anti-cache param
  44356. cacheURL,
  44357. // Response headers
  44358. responseHeadersString,
  44359. responseHeaders,
  44360. // timeout handle
  44361. timeoutTimer,
  44362. // Url cleanup var
  44363. urlAnchor,
  44364. // Request state (becomes false upon send and true upon completion)
  44365. completed,
  44366. // To know if global events are to be dispatched
  44367. fireGlobals,
  44368. // Loop variable
  44369. i,
  44370. // uncached part of the url
  44371. uncached,
  44372. // Create the final options object
  44373. s = jQuery.ajaxSetup({}, options),
  44374. // Callbacks context
  44375. callbackContext = s.context || s,
  44376. // Context for global events is callbackContext if it is a DOM node or jQuery collection
  44377. globalEventContext = s.context && (callbackContext.nodeType || callbackContext.jquery) ? jQuery(callbackContext) : jQuery.event,
  44378. // Deferreds
  44379. deferred = jQuery.Deferred(),
  44380. completeDeferred = jQuery.Callbacks("once memory"),
  44381. // Status-dependent callbacks
  44382. _statusCode = s.statusCode || {},
  44383. // Headers (they are sent all at once)
  44384. requestHeaders = {},
  44385. requestHeadersNames = {},
  44386. // Default abort message
  44387. strAbort = "canceled",
  44388. // Fake xhr
  44389. jqXHR = {
  44390. readyState: 0,
  44391. // Builds headers hashtable if needed
  44392. getResponseHeader: function getResponseHeader(key) {
  44393. var match;
  44394. if (completed) {
  44395. if (!responseHeaders) {
  44396. responseHeaders = {};
  44397. while (match = rheaders.exec(responseHeadersString)) {
  44398. responseHeaders[match[1].toLowerCase()] = match[2];
  44399. }
  44400. }
  44401. match = responseHeaders[key.toLowerCase()];
  44402. }
  44403. return match == null ? null : match;
  44404. },
  44405. // Raw string
  44406. getAllResponseHeaders: function getAllResponseHeaders() {
  44407. return completed ? responseHeadersString : null;
  44408. },
  44409. // Caches the header
  44410. setRequestHeader: function setRequestHeader(name, value) {
  44411. if (completed == null) {
  44412. name = requestHeadersNames[name.toLowerCase()] = requestHeadersNames[name.toLowerCase()] || name;
  44413. requestHeaders[name] = value;
  44414. }
  44415. return this;
  44416. },
  44417. // Overrides response content-type header
  44418. overrideMimeType: function overrideMimeType(type) {
  44419. if (completed == null) {
  44420. s.mimeType = type;
  44421. }
  44422. return this;
  44423. },
  44424. // Status-dependent callbacks
  44425. statusCode: function statusCode(map) {
  44426. var code;
  44427. if (map) {
  44428. if (completed) {
  44429. // Execute the appropriate callbacks
  44430. jqXHR.always(map[jqXHR.status]);
  44431. } else {
  44432. // Lazy-add the new callbacks in a way that preserves old ones
  44433. for (code in map) {
  44434. _statusCode[code] = [_statusCode[code], map[code]];
  44435. }
  44436. }
  44437. }
  44438. return this;
  44439. },
  44440. // Cancel the request
  44441. abort: function abort(statusText) {
  44442. var finalText = statusText || strAbort;
  44443. if (transport) {
  44444. transport.abort(finalText);
  44445. }
  44446. done(0, finalText);
  44447. return this;
  44448. }
  44449. };
  44450. // Attach deferreds
  44451. deferred.promise(jqXHR);
  44452. // Add protocol if not provided (prefilters might expect it)
  44453. // Handle falsy url in the settings object (#10093: consistency with old signature)
  44454. // We also use the url parameter if available
  44455. s.url = ((url || s.url || location.href) + "").replace(rprotocol, location.protocol + "//");
  44456. // Alias method option to type as per ticket #12004
  44457. s.type = options.method || options.type || s.method || s.type;
  44458. // Extract dataTypes list
  44459. s.dataTypes = (s.dataType || "*").toLowerCase().match(rnothtmlwhite) || [""];
  44460. // A cross-domain request is in order when the origin doesn't match the current origin.
  44461. if (s.crossDomain == null) {
  44462. urlAnchor = document.createElement("a");
  44463. // Support: IE <=8 - 11, Edge 12 - 15
  44464. // IE throws exception on accessing the href property if url is malformed,
  44465. // e.g. http://example.com:80x/
  44466. try {
  44467. urlAnchor.href = s.url;
  44468. // Support: IE <=8 - 11 only
  44469. // Anchor's host property isn't correctly set when s.url is relative
  44470. urlAnchor.href = urlAnchor.href;
  44471. s.crossDomain = originAnchor.protocol + "//" + originAnchor.host !== urlAnchor.protocol + "//" + urlAnchor.host;
  44472. } catch (e) {
  44473. // If there is an error parsing the URL, assume it is crossDomain,
  44474. // it can be rejected by the transport if it is invalid
  44475. s.crossDomain = true;
  44476. }
  44477. }
  44478. // Convert data if not already a string
  44479. if (s.data && s.processData && typeof s.data !== "string") {
  44480. s.data = jQuery.param(s.data, s.traditional);
  44481. }
  44482. // Apply prefilters
  44483. inspectPrefiltersOrTransports(prefilters, s, options, jqXHR);
  44484. // If request was aborted inside a prefilter, stop there
  44485. if (completed) {
  44486. return jqXHR;
  44487. }
  44488. // We can fire global events as of now if asked to
  44489. // Don't fire events if jQuery.event is undefined in an AMD-usage scenario (#15118)
  44490. fireGlobals = jQuery.event && s.global;
  44491. // Watch for a new set of requests
  44492. if (fireGlobals && jQuery.active++ === 0) {
  44493. jQuery.event.trigger("ajaxStart");
  44494. }
  44495. // Uppercase the type
  44496. s.type = s.type.toUpperCase();
  44497. // Determine if request has content
  44498. s.hasContent = !rnoContent.test(s.type);
  44499. // Save the URL in case we're toying with the If-Modified-Since
  44500. // and/or If-None-Match header later on
  44501. // Remove hash to simplify url manipulation
  44502. cacheURL = s.url.replace(rhash, "");
  44503. // More options handling for requests with no content
  44504. if (!s.hasContent) {
  44505. // Remember the hash so we can put it back
  44506. uncached = s.url.slice(cacheURL.length);
  44507. // If data is available and should be processed, append data to url
  44508. if (s.data && (s.processData || typeof s.data === "string")) {
  44509. cacheURL += (rquery.test(cacheURL) ? "&" : "?") + s.data;
  44510. // #9682: remove data so that it's not used in an eventual retry
  44511. delete s.data;
  44512. }
  44513. // Add or update anti-cache param if needed
  44514. if (s.cache === false) {
  44515. cacheURL = cacheURL.replace(rantiCache, "$1");
  44516. uncached = (rquery.test(cacheURL) ? "&" : "?") + "_=" + nonce++ + uncached;
  44517. }
  44518. // Put hash and anti-cache on the URL that will be requested (gh-1732)
  44519. s.url = cacheURL + uncached;
  44520. // Change '%20' to '+' if this is encoded form body content (gh-2658)
  44521. } else if (s.data && s.processData && (s.contentType || "").indexOf("application/x-www-form-urlencoded") === 0) {
  44522. s.data = s.data.replace(r20, "+");
  44523. }
  44524. // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
  44525. if (s.ifModified) {
  44526. if (jQuery.lastModified[cacheURL]) {
  44527. jqXHR.setRequestHeader("If-Modified-Since", jQuery.lastModified[cacheURL]);
  44528. }
  44529. if (jQuery.etag[cacheURL]) {
  44530. jqXHR.setRequestHeader("If-None-Match", jQuery.etag[cacheURL]);
  44531. }
  44532. }
  44533. // Set the correct header, if data is being sent
  44534. if (s.data && s.hasContent && s.contentType !== false || options.contentType) {
  44535. jqXHR.setRequestHeader("Content-Type", s.contentType);
  44536. }
  44537. // Set the Accepts header for the server, depending on the dataType
  44538. 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["*"]);
  44539. // Check for headers option
  44540. for (i in s.headers) {
  44541. jqXHR.setRequestHeader(i, s.headers[i]);
  44542. }
  44543. // Allow custom headers/mimetypes and early abort
  44544. if (s.beforeSend && (s.beforeSend.call(callbackContext, jqXHR, s) === false || completed)) {
  44545. // Abort if not done already and return
  44546. return jqXHR.abort();
  44547. }
  44548. // Aborting is no longer a cancellation
  44549. strAbort = "abort";
  44550. // Install callbacks on deferreds
  44551. completeDeferred.add(s.complete);
  44552. jqXHR.done(s.success);
  44553. jqXHR.fail(s.error);
  44554. // Get transport
  44555. transport = inspectPrefiltersOrTransports(transports, s, options, jqXHR);
  44556. // If no transport, we auto-abort
  44557. if (!transport) {
  44558. done(-1, "No Transport");
  44559. } else {
  44560. jqXHR.readyState = 1;
  44561. // Send global event
  44562. if (fireGlobals) {
  44563. globalEventContext.trigger("ajaxSend", [jqXHR, s]);
  44564. }
  44565. // If request was aborted inside ajaxSend, stop there
  44566. if (completed) {
  44567. return jqXHR;
  44568. }
  44569. // Timeout
  44570. if (s.async && s.timeout > 0) {
  44571. timeoutTimer = window.setTimeout(function () {
  44572. jqXHR.abort("timeout");
  44573. }, s.timeout);
  44574. }
  44575. try {
  44576. completed = false;
  44577. transport.send(requestHeaders, done);
  44578. } catch (e) {
  44579. // Rethrow post-completion exceptions
  44580. if (completed) {
  44581. throw e;
  44582. }
  44583. // Propagate others as results
  44584. done(-1, e);
  44585. }
  44586. }
  44587. // Callback for when everything is done
  44588. function done(status, nativeStatusText, responses, headers) {
  44589. var isSuccess,
  44590. success,
  44591. error,
  44592. response,
  44593. modified,
  44594. statusText = nativeStatusText;
  44595. // Ignore repeat invocations
  44596. if (completed) {
  44597. return;
  44598. }
  44599. completed = true;
  44600. // Clear timeout if it exists
  44601. if (timeoutTimer) {
  44602. window.clearTimeout(timeoutTimer);
  44603. }
  44604. // Dereference transport for early garbage collection
  44605. // (no matter how long the jqXHR object will be used)
  44606. transport = undefined;
  44607. // Cache response headers
  44608. responseHeadersString = headers || "";
  44609. // Set readyState
  44610. jqXHR.readyState = status > 0 ? 4 : 0;
  44611. // Determine if successful
  44612. isSuccess = status >= 200 && status < 300 || status === 304;
  44613. // Get response data
  44614. if (responses) {
  44615. response = ajaxHandleResponses(s, jqXHR, responses);
  44616. }
  44617. // Convert no matter what (that way responseXXX fields are always set)
  44618. response = ajaxConvert(s, response, jqXHR, isSuccess);
  44619. // If successful, handle type chaining
  44620. if (isSuccess) {
  44621. // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
  44622. if (s.ifModified) {
  44623. modified = jqXHR.getResponseHeader("Last-Modified");
  44624. if (modified) {
  44625. jQuery.lastModified[cacheURL] = modified;
  44626. }
  44627. modified = jqXHR.getResponseHeader("etag");
  44628. if (modified) {
  44629. jQuery.etag[cacheURL] = modified;
  44630. }
  44631. }
  44632. // if no content
  44633. if (status === 204 || s.type === "HEAD") {
  44634. statusText = "nocontent";
  44635. // if not modified
  44636. } else if (status === 304) {
  44637. statusText = "notmodified";
  44638. // If we have data, let's convert it
  44639. } else {
  44640. statusText = response.state;
  44641. success = response.data;
  44642. error = response.error;
  44643. isSuccess = !error;
  44644. }
  44645. } else {
  44646. // Extract error from statusText and normalize for non-aborts
  44647. error = statusText;
  44648. if (status || !statusText) {
  44649. statusText = "error";
  44650. if (status < 0) {
  44651. status = 0;
  44652. }
  44653. }
  44654. }
  44655. // Set data for the fake xhr object
  44656. jqXHR.status = status;
  44657. jqXHR.statusText = (nativeStatusText || statusText) + "";
  44658. // Success/Error
  44659. if (isSuccess) {
  44660. deferred.resolveWith(callbackContext, [success, statusText, jqXHR]);
  44661. } else {
  44662. deferred.rejectWith(callbackContext, [jqXHR, statusText, error]);
  44663. }
  44664. // Status-dependent callbacks
  44665. jqXHR.statusCode(_statusCode);
  44666. _statusCode = undefined;
  44667. if (fireGlobals) {
  44668. globalEventContext.trigger(isSuccess ? "ajaxSuccess" : "ajaxError", [jqXHR, s, isSuccess ? success : error]);
  44669. }
  44670. // Complete
  44671. completeDeferred.fireWith(callbackContext, [jqXHR, statusText]);
  44672. if (fireGlobals) {
  44673. globalEventContext.trigger("ajaxComplete", [jqXHR, s]);
  44674. // Handle the global AJAX counter
  44675. if (! --jQuery.active) {
  44676. jQuery.event.trigger("ajaxStop");
  44677. }
  44678. }
  44679. }
  44680. return jqXHR;
  44681. },
  44682. getJSON: function getJSON(url, data, callback) {
  44683. return jQuery.get(url, data, callback, "json");
  44684. },
  44685. getScript: function getScript(url, callback) {
  44686. return jQuery.get(url, undefined, callback, "script");
  44687. }
  44688. });
  44689. jQuery.each(["get", "post"], function (i, method) {
  44690. jQuery[method] = function (url, data, callback, type) {
  44691. // Shift arguments if data argument was omitted
  44692. if (isFunction(data)) {
  44693. type = type || callback;
  44694. callback = data;
  44695. data = undefined;
  44696. }
  44697. // The url can be an options object (which then must have .url)
  44698. return jQuery.ajax(jQuery.extend({
  44699. url: url,
  44700. type: method,
  44701. dataType: type,
  44702. data: data,
  44703. success: callback
  44704. }, jQuery.isPlainObject(url) && url));
  44705. };
  44706. });
  44707. jQuery._evalUrl = function (url) {
  44708. return jQuery.ajax({
  44709. url: url,
  44710. // Make this explicit, since user can override this through ajaxSetup (#11264)
  44711. type: "GET",
  44712. dataType: "script",
  44713. cache: true,
  44714. async: false,
  44715. global: false,
  44716. "throws": true
  44717. });
  44718. };
  44719. jQuery.fn.extend({
  44720. wrapAll: function wrapAll(html) {
  44721. var wrap;
  44722. if (this[0]) {
  44723. if (isFunction(html)) {
  44724. html = html.call(this[0]);
  44725. }
  44726. // The elements to wrap the target around
  44727. wrap = jQuery(html, this[0].ownerDocument).eq(0).clone(true);
  44728. if (this[0].parentNode) {
  44729. wrap.insertBefore(this[0]);
  44730. }
  44731. wrap.map(function () {
  44732. var elem = this;
  44733. while (elem.firstElementChild) {
  44734. elem = elem.firstElementChild;
  44735. }
  44736. return elem;
  44737. }).append(this);
  44738. }
  44739. return this;
  44740. },
  44741. wrapInner: function wrapInner(html) {
  44742. if (isFunction(html)) {
  44743. return this.each(function (i) {
  44744. jQuery(this).wrapInner(html.call(this, i));
  44745. });
  44746. }
  44747. return this.each(function () {
  44748. var self = jQuery(this),
  44749. contents = self.contents();
  44750. if (contents.length) {
  44751. contents.wrapAll(html);
  44752. } else {
  44753. self.append(html);
  44754. }
  44755. });
  44756. },
  44757. wrap: function wrap(html) {
  44758. var htmlIsFunction = isFunction(html);
  44759. return this.each(function (i) {
  44760. jQuery(this).wrapAll(htmlIsFunction ? html.call(this, i) : html);
  44761. });
  44762. },
  44763. unwrap: function unwrap(selector) {
  44764. this.parent(selector).not("body").each(function () {
  44765. jQuery(this).replaceWith(this.childNodes);
  44766. });
  44767. return this;
  44768. }
  44769. });
  44770. jQuery.expr.pseudos.hidden = function (elem) {
  44771. return !jQuery.expr.pseudos.visible(elem);
  44772. };
  44773. jQuery.expr.pseudos.visible = function (elem) {
  44774. return !!(elem.offsetWidth || elem.offsetHeight || elem.getClientRects().length);
  44775. };
  44776. jQuery.ajaxSettings.xhr = function () {
  44777. try {
  44778. return new window.XMLHttpRequest();
  44779. } catch (e) {}
  44780. };
  44781. var xhrSuccessStatus = {
  44782. // File protocol always yields status code 0, assume 200
  44783. 0: 200,
  44784. // Support: IE <=9 only
  44785. // #1450: sometimes IE returns 1223 when it should be 204
  44786. 1223: 204
  44787. },
  44788. xhrSupported = jQuery.ajaxSettings.xhr();
  44789. support.cors = !!xhrSupported && "withCredentials" in xhrSupported;
  44790. support.ajax = xhrSupported = !!xhrSupported;
  44791. jQuery.ajaxTransport(function (options) {
  44792. var _callback, errorCallback;
  44793. // Cross domain only allowed if supported through XMLHttpRequest
  44794. if (support.cors || xhrSupported && !options.crossDomain) {
  44795. return {
  44796. send: function send(headers, complete) {
  44797. var i,
  44798. xhr = options.xhr();
  44799. xhr.open(options.type, options.url, options.async, options.username, options.password);
  44800. // Apply custom fields if provided
  44801. if (options.xhrFields) {
  44802. for (i in options.xhrFields) {
  44803. xhr[i] = options.xhrFields[i];
  44804. }
  44805. }
  44806. // Override mime type if needed
  44807. if (options.mimeType && xhr.overrideMimeType) {
  44808. xhr.overrideMimeType(options.mimeType);
  44809. }
  44810. // X-Requested-With header
  44811. // For cross-domain requests, seeing as conditions for a preflight are
  44812. // akin to a jigsaw puzzle, we simply never set it to be sure.
  44813. // (it can always be set on a per-request basis or even using ajaxSetup)
  44814. // For same-domain requests, won't change header if already provided.
  44815. if (!options.crossDomain && !headers["X-Requested-With"]) {
  44816. headers["X-Requested-With"] = "XMLHttpRequest";
  44817. }
  44818. // Set headers
  44819. for (i in headers) {
  44820. xhr.setRequestHeader(i, headers[i]);
  44821. }
  44822. // Callback
  44823. _callback = function callback(type) {
  44824. return function () {
  44825. if (_callback) {
  44826. _callback = errorCallback = xhr.onload = xhr.onerror = xhr.onabort = xhr.ontimeout = xhr.onreadystatechange = null;
  44827. if (type === "abort") {
  44828. xhr.abort();
  44829. } else if (type === "error") {
  44830. // Support: IE <=9 only
  44831. // On a manual native abort, IE9 throws
  44832. // errors on any property access that is not readyState
  44833. if (typeof xhr.status !== "number") {
  44834. complete(0, "error");
  44835. } else {
  44836. complete(
  44837. // File: protocol always yields status 0; see #8605, #14207
  44838. xhr.status, xhr.statusText);
  44839. }
  44840. } else {
  44841. complete(xhrSuccessStatus[xhr.status] || xhr.status, xhr.statusText,
  44842. // Support: IE <=9 only
  44843. // IE9 has no XHR2 but throws on binary (trac-11426)
  44844. // For XHR2 non-text, let the caller handle it (gh-2498)
  44845. (xhr.responseType || "text") !== "text" || typeof xhr.responseText !== "string" ? { binary: xhr.response } : { text: xhr.responseText }, xhr.getAllResponseHeaders());
  44846. }
  44847. }
  44848. };
  44849. };
  44850. // Listen to events
  44851. xhr.onload = _callback();
  44852. errorCallback = xhr.onerror = xhr.ontimeout = _callback("error");
  44853. // Support: IE 9 only
  44854. // Use onreadystatechange to replace onabort
  44855. // to handle uncaught aborts
  44856. if (xhr.onabort !== undefined) {
  44857. xhr.onabort = errorCallback;
  44858. } else {
  44859. xhr.onreadystatechange = function () {
  44860. // Check readyState before timeout as it changes
  44861. if (xhr.readyState === 4) {
  44862. // Allow onerror to be called first,
  44863. // but that will not handle a native abort
  44864. // Also, save errorCallback to a variable
  44865. // as xhr.onerror cannot be accessed
  44866. window.setTimeout(function () {
  44867. if (_callback) {
  44868. errorCallback();
  44869. }
  44870. });
  44871. }
  44872. };
  44873. }
  44874. // Create the abort callback
  44875. _callback = _callback("abort");
  44876. try {
  44877. // Do send the request (this may raise an exception)
  44878. xhr.send(options.hasContent && options.data || null);
  44879. } catch (e) {
  44880. // #14683: Only rethrow if this hasn't been notified as an error yet
  44881. if (_callback) {
  44882. throw e;
  44883. }
  44884. }
  44885. },
  44886. abort: function abort() {
  44887. if (_callback) {
  44888. _callback();
  44889. }
  44890. }
  44891. };
  44892. }
  44893. });
  44894. // Prevent auto-execution of scripts when no explicit dataType was provided (See gh-2432)
  44895. jQuery.ajaxPrefilter(function (s) {
  44896. if (s.crossDomain) {
  44897. s.contents.script = false;
  44898. }
  44899. });
  44900. // Install script dataType
  44901. jQuery.ajaxSetup({
  44902. accepts: {
  44903. script: "text/javascript, application/javascript, " + "application/ecmascript, application/x-ecmascript"
  44904. },
  44905. contents: {
  44906. script: /\b(?:java|ecma)script\b/
  44907. },
  44908. converters: {
  44909. "text script": function textScript(text) {
  44910. jQuery.globalEval(text);
  44911. return text;
  44912. }
  44913. }
  44914. });
  44915. // Handle cache's special case and crossDomain
  44916. jQuery.ajaxPrefilter("script", function (s) {
  44917. if (s.cache === undefined) {
  44918. s.cache = false;
  44919. }
  44920. if (s.crossDomain) {
  44921. s.type = "GET";
  44922. }
  44923. });
  44924. // Bind script tag hack transport
  44925. jQuery.ajaxTransport("script", function (s) {
  44926. // This transport only deals with cross domain requests
  44927. if (s.crossDomain) {
  44928. var script, _callback2;
  44929. return {
  44930. send: function send(_, complete) {
  44931. script = jQuery("<script>").prop({
  44932. charset: s.scriptCharset,
  44933. src: s.url
  44934. }).on("load error", _callback2 = function callback(evt) {
  44935. script.remove();
  44936. _callback2 = null;
  44937. if (evt) {
  44938. complete(evt.type === "error" ? 404 : 200, evt.type);
  44939. }
  44940. });
  44941. // Use native DOM manipulation to avoid our domManip AJAX trickery
  44942. document.head.appendChild(script[0]);
  44943. },
  44944. abort: function abort() {
  44945. if (_callback2) {
  44946. _callback2();
  44947. }
  44948. }
  44949. };
  44950. }
  44951. });
  44952. var oldCallbacks = [],
  44953. rjsonp = /(=)\?(?=&|$)|\?\?/;
  44954. // Default jsonp settings
  44955. jQuery.ajaxSetup({
  44956. jsonp: "callback",
  44957. jsonpCallback: function jsonpCallback() {
  44958. var callback = oldCallbacks.pop() || jQuery.expando + "_" + nonce++;
  44959. this[callback] = true;
  44960. return callback;
  44961. }
  44962. });
  44963. // Detect, normalize options and install callbacks for jsonp requests
  44964. jQuery.ajaxPrefilter("json jsonp", function (s, originalSettings, jqXHR) {
  44965. var callbackName,
  44966. overwritten,
  44967. responseContainer,
  44968. 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");
  44969. // Handle iff the expected data type is "jsonp" or we have a parameter to set
  44970. if (jsonProp || s.dataTypes[0] === "jsonp") {
  44971. // Get callback name, remembering preexisting value associated with it
  44972. callbackName = s.jsonpCallback = isFunction(s.jsonpCallback) ? s.jsonpCallback() : s.jsonpCallback;
  44973. // Insert callback into url or form data
  44974. if (jsonProp) {
  44975. s[jsonProp] = s[jsonProp].replace(rjsonp, "$1" + callbackName);
  44976. } else if (s.jsonp !== false) {
  44977. s.url += (rquery.test(s.url) ? "&" : "?") + s.jsonp + "=" + callbackName;
  44978. }
  44979. // Use data converter to retrieve json after script execution
  44980. s.converters["script json"] = function () {
  44981. if (!responseContainer) {
  44982. jQuery.error(callbackName + " was not called");
  44983. }
  44984. return responseContainer[0];
  44985. };
  44986. // Force json dataType
  44987. s.dataTypes[0] = "json";
  44988. // Install callback
  44989. overwritten = window[callbackName];
  44990. window[callbackName] = function () {
  44991. responseContainer = arguments;
  44992. };
  44993. // Clean-up function (fires after converters)
  44994. jqXHR.always(function () {
  44995. // If previous value didn't exist - remove it
  44996. if (overwritten === undefined) {
  44997. jQuery(window).removeProp(callbackName);
  44998. // Otherwise restore preexisting value
  44999. } else {
  45000. window[callbackName] = overwritten;
  45001. }
  45002. // Save back as free
  45003. if (s[callbackName]) {
  45004. // Make sure that re-using the options doesn't screw things around
  45005. s.jsonpCallback = originalSettings.jsonpCallback;
  45006. // Save the callback name for future use
  45007. oldCallbacks.push(callbackName);
  45008. }
  45009. // Call if it was a function and we have a response
  45010. if (responseContainer && isFunction(overwritten)) {
  45011. overwritten(responseContainer[0]);
  45012. }
  45013. responseContainer = overwritten = undefined;
  45014. });
  45015. // Delegate to script
  45016. return "script";
  45017. }
  45018. });
  45019. // Support: Safari 8 only
  45020. // In Safari 8 documents created via document.implementation.createHTMLDocument
  45021. // collapse sibling forms: the second one becomes a child of the first one.
  45022. // Because of that, this security measure has to be disabled in Safari 8.
  45023. // https://bugs.webkit.org/show_bug.cgi?id=137337
  45024. support.createHTMLDocument = function () {
  45025. var body = document.implementation.createHTMLDocument("").body;
  45026. body.innerHTML = "<form></form><form></form>";
  45027. return body.childNodes.length === 2;
  45028. }();
  45029. // Argument "data" should be string of html
  45030. // context (optional): If specified, the fragment will be created in this context,
  45031. // defaults to document
  45032. // keepScripts (optional): If true, will include scripts passed in the html string
  45033. jQuery.parseHTML = function (data, context, keepScripts) {
  45034. if (typeof data !== "string") {
  45035. return [];
  45036. }
  45037. if (typeof context === "boolean") {
  45038. keepScripts = context;
  45039. context = false;
  45040. }
  45041. var base, parsed, scripts;
  45042. if (!context) {
  45043. // Stop scripts or inline event handlers from being executed immediately
  45044. // by using document.implementation
  45045. if (support.createHTMLDocument) {
  45046. context = document.implementation.createHTMLDocument("");
  45047. // Set the base href for the created document
  45048. // so any parsed elements with URLs
  45049. // are based on the document's URL (gh-2965)
  45050. base = context.createElement("base");
  45051. base.href = document.location.href;
  45052. context.head.appendChild(base);
  45053. } else {
  45054. context = document;
  45055. }
  45056. }
  45057. parsed = rsingleTag.exec(data);
  45058. scripts = !keepScripts && [];
  45059. // Single tag
  45060. if (parsed) {
  45061. return [context.createElement(parsed[1])];
  45062. }
  45063. parsed = buildFragment([data], context, scripts);
  45064. if (scripts && scripts.length) {
  45065. jQuery(scripts).remove();
  45066. }
  45067. return jQuery.merge([], parsed.childNodes);
  45068. };
  45069. /**
  45070. * Load a url into a page
  45071. */
  45072. jQuery.fn.load = function (url, params, callback) {
  45073. var selector,
  45074. type,
  45075. response,
  45076. self = this,
  45077. off = url.indexOf(" ");
  45078. if (off > -1) {
  45079. selector = stripAndCollapse(url.slice(off));
  45080. url = url.slice(0, off);
  45081. }
  45082. // If it's a function
  45083. if (isFunction(params)) {
  45084. // We assume that it's the callback
  45085. callback = params;
  45086. params = undefined;
  45087. // Otherwise, build a param string
  45088. } else if (params && (typeof params === "undefined" ? "undefined" : _typeof(params)) === "object") {
  45089. type = "POST";
  45090. }
  45091. // If we have elements to modify, make the request
  45092. if (self.length > 0) {
  45093. jQuery.ajax({
  45094. url: url,
  45095. // If "type" variable is undefined, then "GET" method will be used.
  45096. // Make value of this field explicit since
  45097. // user can override it through ajaxSetup method
  45098. type: type || "GET",
  45099. dataType: "html",
  45100. data: params
  45101. }).done(function (responseText) {
  45102. // Save response for use in complete callback
  45103. response = arguments;
  45104. self.html(selector ?
  45105. // If a selector was specified, locate the right elements in a dummy div
  45106. // Exclude scripts to avoid IE 'Permission Denied' errors
  45107. jQuery("<div>").append(jQuery.parseHTML(responseText)).find(selector) :
  45108. // Otherwise use the full result
  45109. responseText);
  45110. // If the request succeeds, this function gets "data", "status", "jqXHR"
  45111. // but they are ignored because response was set above.
  45112. // If it fails, this function gets "jqXHR", "status", "error"
  45113. }).always(callback && function (jqXHR, status) {
  45114. self.each(function () {
  45115. callback.apply(this, response || [jqXHR.responseText, status, jqXHR]);
  45116. });
  45117. });
  45118. }
  45119. return this;
  45120. };
  45121. // Attach a bunch of functions for handling common AJAX events
  45122. jQuery.each(["ajaxStart", "ajaxStop", "ajaxComplete", "ajaxError", "ajaxSuccess", "ajaxSend"], function (i, type) {
  45123. jQuery.fn[type] = function (fn) {
  45124. return this.on(type, fn);
  45125. };
  45126. });
  45127. jQuery.expr.pseudos.animated = function (elem) {
  45128. return jQuery.grep(jQuery.timers, function (fn) {
  45129. return elem === fn.elem;
  45130. }).length;
  45131. };
  45132. jQuery.offset = {
  45133. setOffset: function setOffset(elem, options, i) {
  45134. var curPosition,
  45135. curLeft,
  45136. curCSSTop,
  45137. curTop,
  45138. curOffset,
  45139. curCSSLeft,
  45140. calculatePosition,
  45141. position = jQuery.css(elem, "position"),
  45142. curElem = jQuery(elem),
  45143. props = {};
  45144. // Set position first, in-case top/left are set even on static elem
  45145. if (position === "static") {
  45146. elem.style.position = "relative";
  45147. }
  45148. curOffset = curElem.offset();
  45149. curCSSTop = jQuery.css(elem, "top");
  45150. curCSSLeft = jQuery.css(elem, "left");
  45151. calculatePosition = (position === "absolute" || position === "fixed") && (curCSSTop + curCSSLeft).indexOf("auto") > -1;
  45152. // Need to be able to calculate position if either
  45153. // top or left is auto and position is either absolute or fixed
  45154. if (calculatePosition) {
  45155. curPosition = curElem.position();
  45156. curTop = curPosition.top;
  45157. curLeft = curPosition.left;
  45158. } else {
  45159. curTop = parseFloat(curCSSTop) || 0;
  45160. curLeft = parseFloat(curCSSLeft) || 0;
  45161. }
  45162. if (isFunction(options)) {
  45163. // Use jQuery.extend here to allow modification of coordinates argument (gh-1848)
  45164. options = options.call(elem, i, jQuery.extend({}, curOffset));
  45165. }
  45166. if (options.top != null) {
  45167. props.top = options.top - curOffset.top + curTop;
  45168. }
  45169. if (options.left != null) {
  45170. props.left = options.left - curOffset.left + curLeft;
  45171. }
  45172. if ("using" in options) {
  45173. options.using.call(elem, props);
  45174. } else {
  45175. curElem.css(props);
  45176. }
  45177. }
  45178. };
  45179. jQuery.fn.extend({
  45180. // offset() relates an element's border box to the document origin
  45181. offset: function offset(options) {
  45182. // Preserve chaining for setter
  45183. if (arguments.length) {
  45184. return options === undefined ? this : this.each(function (i) {
  45185. jQuery.offset.setOffset(this, options, i);
  45186. });
  45187. }
  45188. var rect,
  45189. win,
  45190. elem = this[0];
  45191. if (!elem) {
  45192. return;
  45193. }
  45194. // Return zeros for disconnected and hidden (display: none) elements (gh-2310)
  45195. // Support: IE <=11 only
  45196. // Running getBoundingClientRect on a
  45197. // disconnected node in IE throws an error
  45198. if (!elem.getClientRects().length) {
  45199. return { top: 0, left: 0 };
  45200. }
  45201. // Get document-relative position by adding viewport scroll to viewport-relative gBCR
  45202. rect = elem.getBoundingClientRect();
  45203. win = elem.ownerDocument.defaultView;
  45204. return {
  45205. top: rect.top + win.pageYOffset,
  45206. left: rect.left + win.pageXOffset
  45207. };
  45208. },
  45209. // position() relates an element's margin box to its offset parent's padding box
  45210. // This corresponds to the behavior of CSS absolute positioning
  45211. position: function position() {
  45212. if (!this[0]) {
  45213. return;
  45214. }
  45215. var offsetParent,
  45216. offset,
  45217. doc,
  45218. elem = this[0],
  45219. parentOffset = { top: 0, left: 0 };
  45220. // position:fixed elements are offset from the viewport, which itself always has zero offset
  45221. if (jQuery.css(elem, "position") === "fixed") {
  45222. // Assume position:fixed implies availability of getBoundingClientRect
  45223. offset = elem.getBoundingClientRect();
  45224. } else {
  45225. offset = this.offset();
  45226. // Account for the *real* offset parent, which can be the document or its root element
  45227. // when a statically positioned element is identified
  45228. doc = elem.ownerDocument;
  45229. offsetParent = elem.offsetParent || doc.documentElement;
  45230. while (offsetParent && (offsetParent === doc.body || offsetParent === doc.documentElement) && jQuery.css(offsetParent, "position") === "static") {
  45231. offsetParent = offsetParent.parentNode;
  45232. }
  45233. if (offsetParent && offsetParent !== elem && offsetParent.nodeType === 1) {
  45234. // Incorporate borders into its offset, since they are outside its content origin
  45235. parentOffset = jQuery(offsetParent).offset();
  45236. parentOffset.top += jQuery.css(offsetParent, "borderTopWidth", true);
  45237. parentOffset.left += jQuery.css(offsetParent, "borderLeftWidth", true);
  45238. }
  45239. }
  45240. // Subtract parent offsets and element margins
  45241. return {
  45242. top: offset.top - parentOffset.top - jQuery.css(elem, "marginTop", true),
  45243. left: offset.left - parentOffset.left - jQuery.css(elem, "marginLeft", true)
  45244. };
  45245. },
  45246. // This method will return documentElement in the following cases:
  45247. // 1) For the element inside the iframe without offsetParent, this method will return
  45248. // documentElement of the parent window
  45249. // 2) For the hidden or detached element
  45250. // 3) For body or html element, i.e. in case of the html node - it will return itself
  45251. //
  45252. // but those exceptions were never presented as a real life use-cases
  45253. // and might be considered as more preferable results.
  45254. //
  45255. // This logic, however, is not guaranteed and can change at any point in the future
  45256. offsetParent: function offsetParent() {
  45257. return this.map(function () {
  45258. var offsetParent = this.offsetParent;
  45259. while (offsetParent && jQuery.css(offsetParent, "position") === "static") {
  45260. offsetParent = offsetParent.offsetParent;
  45261. }
  45262. return offsetParent || documentElement;
  45263. });
  45264. }
  45265. });
  45266. // Create scrollLeft and scrollTop methods
  45267. jQuery.each({ scrollLeft: "pageXOffset", scrollTop: "pageYOffset" }, function (method, prop) {
  45268. var top = "pageYOffset" === prop;
  45269. jQuery.fn[method] = function (val) {
  45270. return access(this, function (elem, method, val) {
  45271. // Coalesce documents and windows
  45272. var win;
  45273. if (isWindow(elem)) {
  45274. win = elem;
  45275. } else if (elem.nodeType === 9) {
  45276. win = elem.defaultView;
  45277. }
  45278. if (val === undefined) {
  45279. return win ? win[prop] : elem[method];
  45280. }
  45281. if (win) {
  45282. win.scrollTo(!top ? val : win.pageXOffset, top ? val : win.pageYOffset);
  45283. } else {
  45284. elem[method] = val;
  45285. }
  45286. }, method, val, arguments.length);
  45287. };
  45288. });
  45289. // Support: Safari <=7 - 9.1, Chrome <=37 - 49
  45290. // Add the top/left cssHooks using jQuery.fn.position
  45291. // Webkit bug: https://bugs.webkit.org/show_bug.cgi?id=29084
  45292. // Blink bug: https://bugs.chromium.org/p/chromium/issues/detail?id=589347
  45293. // getComputedStyle returns percent when specified for top/left/bottom/right;
  45294. // rather than make the css module depend on the offset module, just check for it here
  45295. jQuery.each(["top", "left"], function (i, prop) {
  45296. jQuery.cssHooks[prop] = addGetHookIf(support.pixelPosition, function (elem, computed) {
  45297. if (computed) {
  45298. computed = curCSS(elem, prop);
  45299. // If curCSS returns percentage, fallback to offset
  45300. return rnumnonpx.test(computed) ? jQuery(elem).position()[prop] + "px" : computed;
  45301. }
  45302. });
  45303. });
  45304. // Create innerHeight, innerWidth, height, width, outerHeight and outerWidth methods
  45305. jQuery.each({ Height: "height", Width: "width" }, function (name, type) {
  45306. jQuery.each({ padding: "inner" + name, content: type, "": "outer" + name }, function (defaultExtra, funcName) {
  45307. // Margin is only for outerHeight, outerWidth
  45308. jQuery.fn[funcName] = function (margin, value) {
  45309. var chainable = arguments.length && (defaultExtra || typeof margin !== "boolean"),
  45310. extra = defaultExtra || (margin === true || value === true ? "margin" : "border");
  45311. return access(this, function (elem, type, value) {
  45312. var doc;
  45313. if (isWindow(elem)) {
  45314. // $( window ).outerWidth/Height return w/h including scrollbars (gh-1729)
  45315. return funcName.indexOf("outer") === 0 ? elem["inner" + name] : elem.document.documentElement["client" + name];
  45316. }
  45317. // Get document width or height
  45318. if (elem.nodeType === 9) {
  45319. doc = elem.documentElement;
  45320. // Either scroll[Width/Height] or offset[Width/Height] or client[Width/Height],
  45321. // whichever is greatest
  45322. return Math.max(elem.body["scroll" + name], doc["scroll" + name], elem.body["offset" + name], doc["offset" + name], doc["client" + name]);
  45323. }
  45324. return value === undefined ?
  45325. // Get width or height on the element, requesting but not forcing parseFloat
  45326. jQuery.css(elem, type, extra) :
  45327. // Set width or height on the element
  45328. jQuery.style(elem, type, value, extra);
  45329. }, type, chainable ? margin : undefined, chainable);
  45330. };
  45331. });
  45332. });
  45333. 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) {
  45334. // Handle event binding
  45335. jQuery.fn[name] = function (data, fn) {
  45336. return arguments.length > 0 ? this.on(name, null, data, fn) : this.trigger(name);
  45337. };
  45338. });
  45339. jQuery.fn.extend({
  45340. hover: function hover(fnOver, fnOut) {
  45341. return this.mouseenter(fnOver).mouseleave(fnOut || fnOver);
  45342. }
  45343. });
  45344. jQuery.fn.extend({
  45345. bind: function bind(types, data, fn) {
  45346. return this.on(types, null, data, fn);
  45347. },
  45348. unbind: function unbind(types, fn) {
  45349. return this.off(types, null, fn);
  45350. },
  45351. delegate: function delegate(selector, types, data, fn) {
  45352. return this.on(types, selector, data, fn);
  45353. },
  45354. undelegate: function undelegate(selector, types, fn) {
  45355. // ( namespace ) or ( selector, types [, fn] )
  45356. return arguments.length === 1 ? this.off(selector, "**") : this.off(types, selector || "**", fn);
  45357. }
  45358. });
  45359. // Bind a function to a context, optionally partially applying any
  45360. // arguments.
  45361. // jQuery.proxy is deprecated to promote standards (specifically Function#bind)
  45362. // However, it is not slated for removal any time soon
  45363. jQuery.proxy = function (fn, context) {
  45364. var tmp, args, proxy;
  45365. if (typeof context === "string") {
  45366. tmp = fn[context];
  45367. context = fn;
  45368. fn = tmp;
  45369. }
  45370. // Quick check to determine if target is callable, in the spec
  45371. // this throws a TypeError, but we will just return undefined.
  45372. if (!isFunction(fn)) {
  45373. return undefined;
  45374. }
  45375. // Simulated bind
  45376. args = _slice.call(arguments, 2);
  45377. proxy = function proxy() {
  45378. return fn.apply(context || this, args.concat(_slice.call(arguments)));
  45379. };
  45380. // Set the guid of unique handler to the same of original handler, so it can be removed
  45381. proxy.guid = fn.guid = fn.guid || jQuery.guid++;
  45382. return proxy;
  45383. };
  45384. jQuery.holdReady = function (hold) {
  45385. if (hold) {
  45386. jQuery.readyWait++;
  45387. } else {
  45388. jQuery.ready(true);
  45389. }
  45390. };
  45391. jQuery.isArray = Array.isArray;
  45392. jQuery.parseJSON = JSON.parse;
  45393. jQuery.nodeName = nodeName;
  45394. jQuery.isFunction = isFunction;
  45395. jQuery.isWindow = isWindow;
  45396. jQuery.camelCase = camelCase;
  45397. jQuery.type = toType;
  45398. jQuery.now = Date.now;
  45399. jQuery.isNumeric = function (obj) {
  45400. // As of jQuery 3.0, isNumeric is limited to
  45401. // strings and numbers (primitives or objects)
  45402. // that can be coerced to finite numbers (gh-2662)
  45403. var type = jQuery.type(obj);
  45404. return (type === "number" || type === "string") &&
  45405. // parseFloat NaNs numeric-cast false positives ("")
  45406. // ...but misinterprets leading-number strings, particularly hex literals ("0x...")
  45407. // subtraction forces infinities to NaN
  45408. !isNaN(obj - parseFloat(obj));
  45409. };
  45410. // Register as a named AMD module, since jQuery can be concatenated with other
  45411. // files that may use define, but not via a proper concatenation script that
  45412. // understands anonymous AMD modules. A named AMD is safest and most robust
  45413. // way to register. Lowercase jquery is used because AMD module names are
  45414. // derived from file names, and jQuery is normally delivered in a lowercase
  45415. // file name. Do this after creating the global so that if an AMD module wants
  45416. // to call noConflict to hide this version of jQuery, it will work.
  45417. // Note that for maximum portability, libraries that are not jQuery should
  45418. // declare themselves as anonymous modules, and avoid setting a global if an
  45419. // AMD loader is present. jQuery is a special case. For more information, see
  45420. // https://github.com/jrburke/requirejs/wiki/Updating-existing-libraries#wiki-anon
  45421. if (true) {
  45422. !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = (function () {
  45423. return jQuery;
  45424. }).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
  45425. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  45426. }
  45427. var
  45428. // Map over jQuery in case of overwrite
  45429. _jQuery = window.jQuery,
  45430. // Map over the $ in case of overwrite
  45431. _$ = window.$;
  45432. jQuery.noConflict = function (deep) {
  45433. if (window.$ === jQuery) {
  45434. window.$ = _$;
  45435. }
  45436. if (deep && window.jQuery === jQuery) {
  45437. window.jQuery = _jQuery;
  45438. }
  45439. return jQuery;
  45440. };
  45441. // Expose jQuery and $ identifiers, even in AMD
  45442. // (#7102#comment:10, https://github.com/jquery/jquery/pull/557)
  45443. // and CommonJS for browser emulators (#13566)
  45444. if (!noGlobal) {
  45445. window.jQuery = window.$ = jQuery;
  45446. }
  45447. return jQuery;
  45448. });
  45449. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../webpack/buildin/module.js */ "./node_modules/webpack/buildin/module.js")(module)))
  45450. /***/ }),
  45451. /***/ "./node_modules/line-i18n/dist/LanguageService.js":
  45452. /*!********************************************************!*\
  45453. !*** ./node_modules/line-i18n/dist/LanguageService.js ***!
  45454. \********************************************************/
  45455. /*! no static exports found */
  45456. /***/ (function(module, exports, __webpack_require__) {
  45457. "use strict";
  45458. Object.defineProperty(exports, "__esModule", {
  45459. value: true
  45460. });
  45461. var LanguageService = /** @class */function () {
  45462. function LanguageService(lsKey, defaultLang) {
  45463. if (defaultLang === void 0) {
  45464. defaultLang = 'pt';
  45465. }
  45466. this.lsKey = lsKey;
  45467. this.defaultLang = defaultLang;
  45468. this.listeners = [];
  45469. this.document = document;
  45470. this.setupListener();
  45471. }
  45472. LanguageService.prototype.setupListener = function () {
  45473. var _this = this;
  45474. if (this.document !== null) {
  45475. this.document.addEventListener("storage", function (event) {
  45476. var e = event;
  45477. if (e.key === _this.lsKey) {
  45478. _this.listeners.forEach(function (l) {
  45479. return l();
  45480. });
  45481. }
  45482. });
  45483. }
  45484. };
  45485. LanguageService.prototype.getLang = function () {
  45486. var lang = localStorage.getItem(this.lsKey);
  45487. if (lang === null || lang === undefined) {
  45488. console.warn("Internal Error: User language information has not been set. Returning default...");
  45489. return this.getDefaultLang();
  45490. }
  45491. return lang;
  45492. };
  45493. LanguageService.prototype.getDefaultLang = function () {
  45494. return this.defaultLang;
  45495. };
  45496. LanguageService.prototype.registerLanguageChangeListener = function (listener) {
  45497. this.listeners.push(listener);
  45498. };
  45499. return LanguageService;
  45500. }();
  45501. exports.LanguageService = LanguageService;
  45502. /***/ }),
  45503. /***/ "./node_modules/line-i18n/dist/LanguageServiceNoLS.js":
  45504. /*!************************************************************!*\
  45505. !*** ./node_modules/line-i18n/dist/LanguageServiceNoLS.js ***!
  45506. \************************************************************/
  45507. /*! no static exports found */
  45508. /***/ (function(module, exports, __webpack_require__) {
  45509. "use strict";
  45510. Object.defineProperty(exports, "__esModule", {
  45511. value: true
  45512. });
  45513. var LanguageServiceNoLS = /** @class */function () {
  45514. function LanguageServiceNoLS(lang) {
  45515. this.lang = lang;
  45516. this.listeners = [];
  45517. }
  45518. LanguageServiceNoLS.prototype.setupListener = function () {};
  45519. LanguageServiceNoLS.prototype.notifyChange = function () {
  45520. this.listeners.forEach(function (l) {
  45521. return l();
  45522. });
  45523. };
  45524. LanguageServiceNoLS.prototype.setLang = function (lang) {
  45525. this.lang = lang;
  45526. this.notifyChange();
  45527. };
  45528. LanguageServiceNoLS.prototype.getLang = function () {
  45529. return this.lang;
  45530. };
  45531. LanguageServiceNoLS.prototype.getDefaultLang = function () {
  45532. return this.lang;
  45533. };
  45534. LanguageServiceNoLS.prototype.registerLanguageChangeListener = function (listener) {
  45535. this.listeners.push(listener);
  45536. };
  45537. return LanguageServiceNoLS;
  45538. }();
  45539. exports.LanguageServiceNoLS = LanguageServiceNoLS;
  45540. /***/ }),
  45541. /***/ "./node_modules/line-i18n/dist/LocalizedStrings.js":
  45542. /*!*********************************************************!*\
  45543. !*** ./node_modules/line-i18n/dist/LocalizedStrings.js ***!
  45544. \*********************************************************/
  45545. /*! no static exports found */
  45546. /***/ (function(module, exports, __webpack_require__) {
  45547. "use strict";
  45548. Object.defineProperty(exports, "__esModule", {
  45549. value: true
  45550. });
  45551. exports.LocalizedStrings = undefined;
  45552. var _StringTypes = __webpack_require__(/*! ./StringTypes */ "./node_modules/line-i18n/dist/StringTypes.js");
  45553. var LocalizedStrings = /** @class */function () {
  45554. function LocalizedStrings(service, i18nData, listenToChange) {
  45555. if (listenToChange === void 0) {
  45556. listenToChange = false;
  45557. }
  45558. var _this = this;
  45559. this.service = service;
  45560. this.i18nData = i18nData;
  45561. this.listenToChange = listenToChange;
  45562. this.document = document;
  45563. if (this.listenToChange) {
  45564. service.registerLanguageChangeListener(function () {
  45565. _this.updateTagText();
  45566. });
  45567. }
  45568. }
  45569. LocalizedStrings.prototype.getString = function (id, type) {
  45570. var i18nObj = this.i18nData[this.service.getLang()];
  45571. if (!!!i18nObj) {
  45572. console.warn("Internal Error. The language set at ivprog.lang is not valid: " + this.service.getLang());
  45573. i18nObj = this.i18nData[this.service.getDefaultLang()];
  45574. }
  45575. if (!!!i18nObj[type]) {
  45576. return "{MISSING_I18N_TYPE_IDENTIFIER}";
  45577. } else if (!!!i18nObj[type][id]) {
  45578. return "{MISSING_I18N_IDENTIFIER}";
  45579. } else {
  45580. return i18nObj[type][id];
  45581. }
  45582. };
  45583. LocalizedStrings.prototype.getOR = function () {
  45584. return this.getUI('join_or');
  45585. };
  45586. LocalizedStrings.prototype.getError = function (id, context) {
  45587. if (context === void 0) {
  45588. context = [];
  45589. }
  45590. var text = this.getString(id, _StringTypes.StringTypes.ERROR);
  45591. return this.processString(text, context);
  45592. };
  45593. LocalizedStrings.prototype.getMessage = function (id, context) {
  45594. if (context === void 0) {
  45595. context = [];
  45596. }
  45597. var text = this.getString(id, _StringTypes.StringTypes.MESSAGE);
  45598. return this.processString(text, context);
  45599. };
  45600. LocalizedStrings.prototype.getUI = function (id, context) {
  45601. if (context === void 0) {
  45602. context = [];
  45603. }
  45604. var text = this.getString(id, _StringTypes.StringTypes.UI);
  45605. return this.processString(text, context);
  45606. };
  45607. LocalizedStrings.prototype.processString = function (text, context) {
  45608. for (var i = 0; i < context.length; i++) {
  45609. var v = context[i];
  45610. text = text.replace('\$' + i, v);
  45611. }
  45612. return text;
  45613. };
  45614. LocalizedStrings.prototype.updateTagText = function (func) {
  45615. var _this = this;
  45616. if (func === void 0) {
  45617. func = null;
  45618. }
  45619. if (this.document !== null) {
  45620. var list = this.document.querySelectorAll("data.i18n");
  45621. list.forEach(function (node) {
  45622. if (func === null) {
  45623. node.innerHTML = _this.processTagTex(node.getAttribute("value"));
  45624. } else {
  45625. node.innerHTML = func(node.getAttribute("value"));
  45626. }
  45627. });
  45628. }
  45629. };
  45630. LocalizedStrings.prototype.processTagTex = function (text) {
  45631. if (text === null) {
  45632. return "<Invalid i18n identifier>";
  45633. }
  45634. var opts = text.split(':');
  45635. var type = opts[0].toLowerCase();
  45636. var id = opts[1];
  45637. if (_StringTypes.StringTypes.ERROR === type) {
  45638. return this.getError(id);
  45639. } else if (_StringTypes.StringTypes.MESSAGE === type) {
  45640. return this.getMessage(id);
  45641. } else if (_StringTypes.StringTypes.UI === type) {
  45642. return this.getUI(id);
  45643. } else {
  45644. console.warn(" A string has been passed to the i18n helper function that was not in the form type:id -> " + text);
  45645. return this.getString(id, type);
  45646. }
  45647. };
  45648. return LocalizedStrings;
  45649. }();
  45650. exports.LocalizedStrings = LocalizedStrings;
  45651. /***/ }),
  45652. /***/ "./node_modules/line-i18n/dist/StringTypes.js":
  45653. /*!****************************************************!*\
  45654. !*** ./node_modules/line-i18n/dist/StringTypes.js ***!
  45655. \****************************************************/
  45656. /*! no static exports found */
  45657. /***/ (function(module, exports, __webpack_require__) {
  45658. "use strict";
  45659. Object.defineProperty(exports, "__esModule", {
  45660. value: true
  45661. });
  45662. var StringTypes = exports.StringTypes = undefined;
  45663. (function (StringTypes) {
  45664. StringTypes["ERROR"] = "error";
  45665. StringTypes["MESSAGE"] = "message";
  45666. StringTypes["UI"] = "ui";
  45667. })(StringTypes || (exports.StringTypes = StringTypes = {}));
  45668. /***/ }),
  45669. /***/ "./node_modules/line-i18n/dist/index.js":
  45670. /*!**********************************************!*\
  45671. !*** ./node_modules/line-i18n/dist/index.js ***!
  45672. \**********************************************/
  45673. /*! no static exports found */
  45674. /***/ (function(module, exports, __webpack_require__) {
  45675. "use strict";
  45676. Object.defineProperty(exports, "__esModule", {
  45677. value: true
  45678. });
  45679. var _LanguageService = __webpack_require__(/*! ./LanguageService */ "./node_modules/line-i18n/dist/LanguageService.js");
  45680. var _LocalizedStrings = __webpack_require__(/*! ./LocalizedStrings */ "./node_modules/line-i18n/dist/LocalizedStrings.js");
  45681. var _StringTypes = __webpack_require__(/*! ./StringTypes */ "./node_modules/line-i18n/dist/StringTypes.js");
  45682. var _LanguageServiceNoLS = __webpack_require__(/*! ./LanguageServiceNoLS */ "./node_modules/line-i18n/dist/LanguageServiceNoLS.js");
  45683. exports.default = {
  45684. LanguageService: _LanguageService.LanguageService,
  45685. LanguageServiceNoLS: _LanguageServiceNoLS.LanguageServiceNoLS,
  45686. LocalizedStrings: _LocalizedStrings.LocalizedStrings,
  45687. StringTypes: _StringTypes.StringTypes
  45688. };
  45689. /***/ }),
  45690. /***/ "./node_modules/melanke-watchjs/src/watch.js":
  45691. /*!***************************************************!*\
  45692. !*** ./node_modules/melanke-watchjs/src/watch.js ***!
  45693. \***************************************************/
  45694. /*! no static exports found */
  45695. /***/ (function(module, exports, __webpack_require__) {
  45696. "use strict";
  45697. var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;/**
  45698. * DEVELOPED BY
  45699. * GIL LOPES BUENO
  45700. * gilbueno.mail@gmail.com
  45701. *
  45702. * WORKS WITH:
  45703. * IE8*, IE 9+, FF 4+, SF 5+, WebKit, CH 7+, OP 12+, BESEN, Rhino 1.7+
  45704. * For IE8 (and other legacy browsers) WatchJS will use dirty checking
  45705. *
  45706. * FORK:
  45707. * https://github.com/melanke/Watch.JS
  45708. *
  45709. * LICENSE: MIT
  45710. */
  45711. 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; };
  45712. (function (factory) {
  45713. if (( false ? undefined : _typeof(exports)) === 'object') {
  45714. // Node. Does not work with strict CommonJS, but
  45715. // only CommonJS-like enviroments that support module.exports,
  45716. // like Node.
  45717. module.exports = factory();
  45718. } else if (true) {
  45719. // AMD. Register as an anonymous module.
  45720. !(__WEBPACK_AMD_DEFINE_FACTORY__ = (factory),
  45721. __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
  45722. (__WEBPACK_AMD_DEFINE_FACTORY__.call(exports, __webpack_require__, exports, module)) :
  45723. __WEBPACK_AMD_DEFINE_FACTORY__),
  45724. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  45725. } else {}
  45726. })(function () {
  45727. var WatchJS = {
  45728. noMore: false, // use WatchJS.suspend(obj) instead
  45729. useDirtyCheck: false, // use only dirty checking to track changes.
  45730. preserveExistingSetters: false
  45731. },
  45732. lengthsubjects = [];
  45733. var dirtyChecklist = [];
  45734. var pendingChanges = []; // used coalesce changes from defineProperty and __defineSetter__
  45735. var supportDefineProperty = false;
  45736. try {
  45737. supportDefineProperty = Object.defineProperty && Object.defineProperty({}, 'x', {});
  45738. } catch (ex) {/* not supported */}
  45739. var isFunction = function isFunction(functionToCheck) {
  45740. var getType = {};
  45741. return functionToCheck && getType.toString.call(functionToCheck) == '[object Function]';
  45742. };
  45743. var isInt = function isInt(x) {
  45744. return x % 1 === 0;
  45745. };
  45746. var isArray = function isArray(obj) {
  45747. return Object.prototype.toString.call(obj) === '[object Array]';
  45748. };
  45749. var isObject = function isObject(obj) {
  45750. return {}.toString.apply(obj) === '[object Object]';
  45751. };
  45752. var getObjDiff = function getObjDiff(a, b) {
  45753. var aplus = [],
  45754. bplus = [];
  45755. if (!(typeof a == "string") && !(typeof b == "string")) {
  45756. if (isArray(a) && b) {
  45757. for (var i = 0; i < a.length; i++) {
  45758. if (b[i] === undefined) aplus.push(i);
  45759. }
  45760. } else {
  45761. for (var i in a) {
  45762. if (a.hasOwnProperty(i)) {
  45763. if (b && !b.hasOwnProperty(i)) {
  45764. aplus.push(i);
  45765. }
  45766. }
  45767. }
  45768. }
  45769. if (isArray(b) && a) {
  45770. for (var j = 0; j < b.length; j++) {
  45771. if (a[j] === undefined) bplus.push(j);
  45772. }
  45773. } else {
  45774. for (var j in b) {
  45775. if (b.hasOwnProperty(j)) {
  45776. if (a && !a.hasOwnProperty(j)) {
  45777. bplus.push(j);
  45778. }
  45779. }
  45780. }
  45781. }
  45782. }
  45783. return {
  45784. added: aplus,
  45785. removed: bplus
  45786. };
  45787. };
  45788. var clone = function clone(obj) {
  45789. if (null == obj || "object" != (typeof obj === 'undefined' ? 'undefined' : _typeof(obj))) {
  45790. return obj;
  45791. }
  45792. var copy = obj.constructor();
  45793. for (var attr in obj) {
  45794. copy[attr] = obj[attr];
  45795. }
  45796. return copy;
  45797. };
  45798. var getExistingSetter = function getExistingSetter(obj, propName) {
  45799. if (WatchJS.preserveExistingSetters) {
  45800. var existing = Object.getOwnPropertyDescriptor(obj, propName);
  45801. return existing.set;
  45802. }
  45803. return undefined;
  45804. };
  45805. var defineGetAndSet = function defineGetAndSet(obj, propName, getter, setter) {
  45806. try {
  45807. var existingSetter = getExistingSetter(obj, propName);
  45808. Object.defineProperty(obj, propName, {
  45809. get: getter,
  45810. set: function set(value) {
  45811. setter.call(this, value, true); // coalesce changes
  45812. if (existingSetter) {
  45813. existingSetter(value);
  45814. }
  45815. },
  45816. enumerable: true,
  45817. configurable: true
  45818. });
  45819. } catch (e1) {
  45820. try {
  45821. Object.prototype.__defineGetter__.call(obj, propName, getter);
  45822. Object.prototype.__defineSetter__.call(obj, propName, function (value) {
  45823. setter.call(this, value, true); // coalesce changes
  45824. });
  45825. } catch (e2) {
  45826. observeDirtyChanges(obj, propName, setter);
  45827. //throw new Error("watchJS error: browser not supported :/")
  45828. }
  45829. }
  45830. };
  45831. var defineProp = function defineProp(obj, propName, value) {
  45832. try {
  45833. Object.defineProperty(obj, propName, {
  45834. enumerable: false,
  45835. configurable: true,
  45836. writable: false,
  45837. value: value
  45838. });
  45839. } catch (error) {
  45840. obj[propName] = value;
  45841. }
  45842. };
  45843. var observeDirtyChanges = function observeDirtyChanges(obj, propName, setter) {
  45844. dirtyChecklist[dirtyChecklist.length] = {
  45845. prop: propName,
  45846. object: obj,
  45847. orig: clone(obj[propName]),
  45848. callback: setter
  45849. };
  45850. };
  45851. var watch = function watch() {
  45852. if (isFunction(arguments[1])) {
  45853. watchAll.apply(this, arguments);
  45854. } else if (isArray(arguments[1])) {
  45855. watchMany.apply(this, arguments);
  45856. } else {
  45857. watchOne.apply(this, arguments);
  45858. }
  45859. };
  45860. var watchAll = function watchAll(obj, watcher, level, addNRemove) {
  45861. if (typeof obj == "string" || !(obj instanceof Object) && !isArray(obj)) {
  45862. //accepts only objects and array (not string)
  45863. return;
  45864. }
  45865. if (isArray(obj)) {
  45866. defineWatcher(obj, "__watchall__", watcher, level); // watch all changes on the array
  45867. if (level === undefined || level > 0) {
  45868. for (var prop = 0; prop < obj.length; prop++) {
  45869. // watch objects in array
  45870. watchAll(obj[prop], watcher, level, addNRemove);
  45871. }
  45872. }
  45873. } else {
  45874. var prop,
  45875. props = [];
  45876. for (prop in obj) {
  45877. //for each attribute if obj is an object
  45878. if (prop == "$val" || !supportDefineProperty && prop === 'watchers') {
  45879. continue;
  45880. }
  45881. if (Object.prototype.hasOwnProperty.call(obj, prop)) {
  45882. props.push(prop); //put in the props
  45883. }
  45884. }
  45885. watchMany(obj, props, watcher, level, addNRemove); //watch all items of the props
  45886. }
  45887. if (addNRemove) {
  45888. pushToLengthSubjects(obj, "$$watchlengthsubjectroot", watcher, level);
  45889. }
  45890. };
  45891. var watchMany = function watchMany(obj, props, watcher, level, addNRemove) {
  45892. if (typeof obj == "string" || !(obj instanceof Object) && !isArray(obj)) {
  45893. //accepts only objects and array (not string)
  45894. return;
  45895. }
  45896. for (var i = 0; i < props.length; i++) {
  45897. //watch each property
  45898. var prop = props[i];
  45899. watchOne(obj, prop, watcher, level, addNRemove);
  45900. }
  45901. };
  45902. var watchOne = function watchOne(obj, prop, watcher, level, addNRemove) {
  45903. if (typeof obj == "string" || !(obj instanceof Object) && !isArray(obj)) {
  45904. //accepts only objects and array (not string)
  45905. return;
  45906. }
  45907. if (isFunction(obj[prop])) {
  45908. //dont watch if it is a function
  45909. return;
  45910. }
  45911. if (obj[prop] != null && (level === undefined || level > 0)) {
  45912. watchAll(obj[prop], watcher, level !== undefined ? level - 1 : level); //recursively watch all attributes of this
  45913. }
  45914. defineWatcher(obj, prop, watcher, level);
  45915. if (addNRemove && (level === undefined || level > 0)) {
  45916. pushToLengthSubjects(obj, prop, watcher, level);
  45917. }
  45918. };
  45919. var unwatch = function unwatch() {
  45920. if (isFunction(arguments[1])) {
  45921. unwatchAll.apply(this, arguments);
  45922. } else if (isArray(arguments[1])) {
  45923. unwatchMany.apply(this, arguments);
  45924. } else {
  45925. unwatchOne.apply(this, arguments);
  45926. }
  45927. };
  45928. var unwatchAll = function unwatchAll(obj, watcher) {
  45929. if (obj instanceof String || !(obj instanceof Object) && !isArray(obj)) {
  45930. //accepts only objects and array (not string)
  45931. return;
  45932. }
  45933. if (isArray(obj)) {
  45934. var props = ['__watchall__'];
  45935. for (var prop = 0; prop < obj.length; prop++) {
  45936. //for each item if obj is an array
  45937. props.push(prop); //put in the props
  45938. }
  45939. unwatchMany(obj, props, watcher); //watch all itens of the props
  45940. } else {
  45941. var unwatchPropsInObject = function unwatchPropsInObject(obj2) {
  45942. var props = [];
  45943. for (var prop2 in obj2) {
  45944. //for each attribute if obj is an object
  45945. if (obj2.hasOwnProperty(prop2)) {
  45946. if (obj2[prop2] instanceof Object) {
  45947. unwatchPropsInObject(obj2[prop2]); //recurs into object props
  45948. } else {
  45949. props.push(prop2); //put in the props
  45950. }
  45951. }
  45952. }
  45953. unwatchMany(obj2, props, watcher); //unwatch all of the props
  45954. };
  45955. unwatchPropsInObject(obj);
  45956. }
  45957. };
  45958. var unwatchMany = function unwatchMany(obj, props, watcher) {
  45959. for (var prop2 in props) {
  45960. //watch each attribute of "props" if is an object
  45961. if (props.hasOwnProperty(prop2)) {
  45962. unwatchOne(obj, props[prop2], watcher);
  45963. }
  45964. }
  45965. };
  45966. var timeouts = [],
  45967. timerID = null;
  45968. function clearTimerID() {
  45969. timerID = null;
  45970. for (var i = 0; i < timeouts.length; i++) {
  45971. timeouts[i]();
  45972. }
  45973. timeouts.length = 0;
  45974. }
  45975. var getTimerID = function getTimerID() {
  45976. if (!timerID) {
  45977. timerID = setTimeout(clearTimerID);
  45978. }
  45979. return timerID;
  45980. };
  45981. var registerTimeout = function registerTimeout(fn) {
  45982. // register function to be called on timeout
  45983. if (timerID == null) getTimerID();
  45984. timeouts[timeouts.length] = fn;
  45985. };
  45986. // Track changes made to an array, object or an object's property
  45987. // and invoke callback with a single change object containing type, value, oldvalue and array splices
  45988. // Syntax:
  45989. // trackChange(obj, callback, recursive, addNRemove)
  45990. // trackChange(obj, prop, callback, recursive, addNRemove)
  45991. var trackChange = function trackChange() {
  45992. var fn = isFunction(arguments[2]) ? trackProperty : trackObject;
  45993. fn.apply(this, arguments);
  45994. };
  45995. // track changes made to an object and invoke callback with a single change object containing type, value and array splices
  45996. var trackObject = function trackObject(obj, callback, recursive, addNRemove) {
  45997. var change = null,
  45998. lastTimerID = -1;
  45999. var isArr = isArray(obj);
  46000. var level,
  46001. fn = function fn(prop, action, newValue, oldValue) {
  46002. var timerID = getTimerID();
  46003. if (lastTimerID !== timerID) {
  46004. // check if timer has changed since last update
  46005. lastTimerID = timerID;
  46006. change = {
  46007. type: 'update'
  46008. };
  46009. change['value'] = obj;
  46010. change['splices'] = null;
  46011. registerTimeout(function () {
  46012. callback.call(this, change);
  46013. change = null;
  46014. });
  46015. }
  46016. // create splices for array changes
  46017. if (isArr && obj === this && change !== null) {
  46018. if (action === 'pop' || action === 'shift') {
  46019. newValue = [];
  46020. oldValue = [oldValue];
  46021. } else if (action === 'push' || action === 'unshift') {
  46022. newValue = [newValue];
  46023. oldValue = [];
  46024. } else if (action !== 'splice') {
  46025. return; // return here - for reverse and sort operations we don't need to return splices. a simple update will do
  46026. }
  46027. if (!change.splices) change.splices = [];
  46028. change.splices[change.splices.length] = {
  46029. index: prop,
  46030. deleteCount: oldValue ? oldValue.length : 0,
  46031. addedCount: newValue ? newValue.length : 0,
  46032. added: newValue,
  46033. deleted: oldValue
  46034. };
  46035. }
  46036. };
  46037. level = recursive == true ? undefined : 0;
  46038. watchAll(obj, fn, level, addNRemove);
  46039. };
  46040. // track changes made to the property of an object and invoke callback with a single change object containing type, value, oldvalue and splices
  46041. var trackProperty = function trackProperty(obj, prop, callback, recursive, addNRemove) {
  46042. if (obj && prop) {
  46043. watchOne(obj, prop, function (prop, action, newvalue, oldvalue) {
  46044. var change = {
  46045. type: 'update'
  46046. };
  46047. change['value'] = newvalue;
  46048. change['oldvalue'] = oldvalue;
  46049. if (recursive && isObject(newvalue) || isArray(newvalue)) {
  46050. trackObject(newvalue, callback, recursive, addNRemove);
  46051. }
  46052. callback.call(this, change);
  46053. }, 0);
  46054. if (recursive && isObject(obj[prop]) || isArray(obj[prop])) {
  46055. trackObject(obj[prop], callback, recursive, addNRemove);
  46056. }
  46057. }
  46058. };
  46059. var defineWatcher = function defineWatcher(obj, prop, watcher, level) {
  46060. var newWatcher = false;
  46061. var isArr = isArray(obj);
  46062. if (!obj.watchers) {
  46063. defineProp(obj, "watchers", {});
  46064. if (isArr) {
  46065. // watch array functions
  46066. watchFunctions(obj, function (index, action, newValue, oldValue) {
  46067. addPendingChange(obj, index, action, newValue, oldValue);
  46068. if (level !== 0 && newValue && (isObject(newValue) || isArray(newValue))) {
  46069. var i,
  46070. n,
  46071. ln,
  46072. wAll,
  46073. watchList = obj.watchers[prop];
  46074. if (wAll = obj.watchers['__watchall__']) {
  46075. watchList = watchList ? watchList.concat(wAll) : wAll;
  46076. }
  46077. ln = watchList ? watchList.length : 0;
  46078. for (i = 0; i < ln; i++) {
  46079. if (action !== 'splice') {
  46080. watchAll(newValue, watchList[i], level === undefined ? level : level - 1);
  46081. } else {
  46082. // watch spliced values
  46083. for (n = 0; n < newValue.length; n++) {
  46084. watchAll(newValue[n], watchList[i], level === undefined ? level : level - 1);
  46085. }
  46086. }
  46087. }
  46088. }
  46089. });
  46090. }
  46091. }
  46092. if (!obj.watchers[prop]) {
  46093. obj.watchers[prop] = [];
  46094. if (!isArr) newWatcher = true;
  46095. }
  46096. for (var i = 0; i < obj.watchers[prop].length; i++) {
  46097. if (obj.watchers[prop][i] === watcher) {
  46098. return;
  46099. }
  46100. }
  46101. obj.watchers[prop].push(watcher); //add the new watcher to the watchers array
  46102. if (newWatcher) {
  46103. var val = obj[prop];
  46104. var getter = function getter() {
  46105. return val;
  46106. };
  46107. var setter = function setter(newval, delayWatcher) {
  46108. var oldval = val;
  46109. val = newval;
  46110. if (level !== 0 && obj[prop] && (isObject(obj[prop]) || isArray(obj[prop])) && !obj[prop].watchers) {
  46111. // watch sub properties
  46112. var i,
  46113. ln = obj.watchers[prop].length;
  46114. for (i = 0; i < ln; i++) {
  46115. watchAll(obj[prop], obj.watchers[prop][i], level === undefined ? level : level - 1);
  46116. }
  46117. }
  46118. //watchFunctions(obj, prop);
  46119. if (isSuspended(obj, prop)) {
  46120. resume(obj, prop);
  46121. return;
  46122. }
  46123. if (!WatchJS.noMore) {
  46124. // this does not work with Object.observe
  46125. //if (JSON.stringify(oldval) !== JSON.stringify(newval)) {
  46126. if (oldval !== newval) {
  46127. if (!delayWatcher) {
  46128. callWatchers(obj, prop, "set", newval, oldval);
  46129. } else {
  46130. addPendingChange(obj, prop, "set", newval, oldval);
  46131. }
  46132. WatchJS.noMore = false;
  46133. }
  46134. }
  46135. };
  46136. if (WatchJS.useDirtyCheck) {
  46137. observeDirtyChanges(obj, prop, setter);
  46138. } else {
  46139. defineGetAndSet(obj, prop, getter, setter);
  46140. }
  46141. }
  46142. };
  46143. var callWatchers = function callWatchers(obj, prop, action, newval, oldval) {
  46144. if (prop !== undefined) {
  46145. var ln,
  46146. wl,
  46147. watchList = obj.watchers[prop];
  46148. if (wl = obj.watchers['__watchall__']) {
  46149. watchList = watchList ? watchList.concat(wl) : wl;
  46150. }
  46151. ln = watchList ? watchList.length : 0;
  46152. for (var wr = 0; wr < ln; wr++) {
  46153. watchList[wr].call(obj, prop, action, newval, oldval);
  46154. }
  46155. } else {
  46156. for (var prop in obj) {
  46157. //call all
  46158. if (obj.hasOwnProperty(prop)) {
  46159. callWatchers(obj, prop, action, newval, oldval);
  46160. }
  46161. }
  46162. }
  46163. };
  46164. var methodNames = ['pop', 'push', 'reverse', 'shift', 'sort', 'slice', 'unshift', 'splice'];
  46165. var defineArrayMethodWatcher = function defineArrayMethodWatcher(obj, original, methodName, callback) {
  46166. defineProp(obj, methodName, function () {
  46167. var index = 0;
  46168. var i, newValue, oldValue, response;
  46169. // get values before splicing array
  46170. if (methodName === 'splice') {
  46171. var start = arguments[0];
  46172. var end = start + arguments[1];
  46173. oldValue = obj.slice(start, end);
  46174. newValue = [];
  46175. for (i = 2; i < arguments.length; i++) {
  46176. newValue[i - 2] = arguments[i];
  46177. }
  46178. index = start;
  46179. } else {
  46180. newValue = arguments.length > 0 ? arguments[0] : undefined;
  46181. }
  46182. response = original.apply(obj, arguments);
  46183. if (methodName !== 'slice') {
  46184. if (methodName === 'pop') {
  46185. oldValue = response;
  46186. index = obj.length;
  46187. } else if (methodName === 'push') {
  46188. index = obj.length - 1;
  46189. } else if (methodName === 'shift') {
  46190. oldValue = response;
  46191. } else if (methodName !== 'unshift' && newValue === undefined) {
  46192. newValue = response;
  46193. }
  46194. callback.call(obj, index, methodName, newValue, oldValue);
  46195. }
  46196. return response;
  46197. });
  46198. };
  46199. var watchFunctions = function watchFunctions(obj, callback) {
  46200. if (!isFunction(callback) || !obj || obj instanceof String || !isArray(obj)) {
  46201. return;
  46202. }
  46203. for (var i = methodNames.length, methodName; i--;) {
  46204. methodName = methodNames[i];
  46205. defineArrayMethodWatcher(obj, obj[methodName], methodName, callback);
  46206. }
  46207. };
  46208. var unwatchOne = function unwatchOne(obj, prop, watcher) {
  46209. if (prop) {
  46210. if (obj.watchers && obj.watchers[prop]) {
  46211. if (watcher === undefined) {
  46212. delete obj.watchers[prop]; // remove all property watchers
  46213. } else {
  46214. for (var i = 0; i < obj.watchers[prop].length; i++) {
  46215. var w = obj.watchers[prop][i];
  46216. if (w == watcher) {
  46217. obj.watchers[prop].splice(i, 1);
  46218. }
  46219. }
  46220. }
  46221. }
  46222. } else {
  46223. delete obj.watchers;
  46224. }
  46225. removeFromLengthSubjects(obj, prop, watcher);
  46226. removeFromDirtyChecklist(obj, prop);
  46227. };
  46228. // suspend watchers until next update cycle
  46229. var suspend = function suspend(obj, prop) {
  46230. if (obj.watchers) {
  46231. var name = '__wjs_suspend__' + (prop !== undefined ? prop : '');
  46232. obj.watchers[name] = true;
  46233. }
  46234. };
  46235. var isSuspended = function isSuspended(obj, prop) {
  46236. return obj.watchers && (obj.watchers['__wjs_suspend__'] || obj.watchers['__wjs_suspend__' + prop]);
  46237. };
  46238. // resumes preivously suspended watchers
  46239. var resume = function resume(obj, prop) {
  46240. registerTimeout(function () {
  46241. delete obj.watchers['__wjs_suspend__'];
  46242. delete obj.watchers['__wjs_suspend__' + prop];
  46243. });
  46244. };
  46245. var pendingTimerID = null;
  46246. var addPendingChange = function addPendingChange(obj, prop, mode, newval, oldval) {
  46247. pendingChanges[pendingChanges.length] = {
  46248. obj: obj,
  46249. prop: prop,
  46250. mode: mode,
  46251. newval: newval,
  46252. oldval: oldval
  46253. };
  46254. if (pendingTimerID === null) {
  46255. pendingTimerID = setTimeout(applyPendingChanges);
  46256. }
  46257. };
  46258. var applyPendingChanges = function applyPendingChanges() {
  46259. // apply pending changes
  46260. var change = null;
  46261. pendingTimerID = null;
  46262. for (var i = 0; i < pendingChanges.length; i++) {
  46263. change = pendingChanges[i];
  46264. callWatchers(change.obj, change.prop, change.mode, change.newval, change.oldval);
  46265. }
  46266. if (change) {
  46267. pendingChanges = [];
  46268. change = null;
  46269. }
  46270. };
  46271. var loop = function loop() {
  46272. // check for new or deleted props
  46273. for (var i = 0; i < lengthsubjects.length; i++) {
  46274. var subj = lengthsubjects[i];
  46275. if (subj.prop === "$$watchlengthsubjectroot") {
  46276. var difference = getObjDiff(subj.obj, subj.actual);
  46277. if (difference.added.length || difference.removed.length) {
  46278. if (difference.added.length) {
  46279. watchMany(subj.obj, difference.added, subj.watcher, subj.level - 1, true);
  46280. }
  46281. subj.watcher.call(subj.obj, "root", "differentattr", difference, subj.actual);
  46282. }
  46283. subj.actual = clone(subj.obj);
  46284. } else {
  46285. var difference = getObjDiff(subj.obj[subj.prop], subj.actual);
  46286. if (difference.added.length || difference.removed.length) {
  46287. if (difference.added.length) {
  46288. for (var j = 0; j < subj.obj.watchers[subj.prop].length; j++) {
  46289. watchMany(subj.obj[subj.prop], difference.added, subj.obj.watchers[subj.prop][j], subj.level - 1, true);
  46290. }
  46291. }
  46292. callWatchers(subj.obj, subj.prop, "differentattr", difference, subj.actual);
  46293. }
  46294. subj.actual = clone(subj.obj[subj.prop]);
  46295. }
  46296. }
  46297. // start dirty check
  46298. var n, value;
  46299. if (dirtyChecklist.length > 0) {
  46300. for (var i = 0; i < dirtyChecklist.length; i++) {
  46301. n = dirtyChecklist[i];
  46302. value = n.object[n.prop];
  46303. if (!compareValues(n.orig, value)) {
  46304. n.orig = clone(value);
  46305. n.callback(value);
  46306. }
  46307. }
  46308. }
  46309. };
  46310. var compareValues = function compareValues(a, b) {
  46311. var i,
  46312. state = true;
  46313. if (a !== b) {
  46314. if (isObject(a)) {
  46315. for (i in a) {
  46316. if (!supportDefineProperty && i === 'watchers') continue;
  46317. if (a[i] !== b[i]) {
  46318. state = false;
  46319. break;
  46320. };
  46321. }
  46322. } else {
  46323. state = false;
  46324. }
  46325. }
  46326. return state;
  46327. };
  46328. var pushToLengthSubjects = function pushToLengthSubjects(obj, prop, watcher, level) {
  46329. var actual;
  46330. if (prop === "$$watchlengthsubjectroot") {
  46331. actual = clone(obj);
  46332. } else {
  46333. actual = clone(obj[prop]);
  46334. }
  46335. lengthsubjects.push({
  46336. obj: obj,
  46337. prop: prop,
  46338. actual: actual,
  46339. watcher: watcher,
  46340. level: level
  46341. });
  46342. };
  46343. var removeFromLengthSubjects = function removeFromLengthSubjects(obj, prop, watcher) {
  46344. for (var i = 0; i < lengthsubjects.length; i++) {
  46345. var subj = lengthsubjects[i];
  46346. if (subj.obj == obj) {
  46347. if (!prop || subj.prop == prop) {
  46348. if (!watcher || subj.watcher == watcher) {
  46349. // if we splice off one item at position i
  46350. // we need to decrement i as the array is one item shorter
  46351. // so when we increment i in the loop statement we
  46352. // will land at the correct index.
  46353. // if it's not decremented, you won't delete all length subjects
  46354. lengthsubjects.splice(i--, 1);
  46355. }
  46356. }
  46357. }
  46358. }
  46359. };
  46360. var removeFromDirtyChecklist = function removeFromDirtyChecklist(obj, prop) {
  46361. var notInUse;
  46362. for (var i = 0; i < dirtyChecklist.length; i++) {
  46363. var n = dirtyChecklist[i];
  46364. var watchers = n.object.watchers;
  46365. notInUse = n.object == obj && (!prop || n.prop == prop) && watchers && (!prop || !watchers[prop] || watchers[prop].length == 0);
  46366. if (notInUse) {
  46367. // we use the same syntax as in removeFromLengthSubjects
  46368. dirtyChecklist.splice(i--, 1);
  46369. }
  46370. }
  46371. };
  46372. setInterval(loop, 50);
  46373. WatchJS.watch = watch;
  46374. WatchJS.unwatch = unwatch;
  46375. WatchJS.callWatchers = callWatchers;
  46376. WatchJS.suspend = suspend; // suspend watchers
  46377. WatchJS.onChange = trackChange; // track changes made to object or it's property and return a single change object
  46378. return WatchJS;
  46379. });
  46380. /***/ }),
  46381. /***/ "./node_modules/node-libs-browser/mock/empty.js":
  46382. /*!******************************************************!*\
  46383. !*** ./node_modules/node-libs-browser/mock/empty.js ***!
  46384. \******************************************************/
  46385. /*! no static exports found */
  46386. /***/ (function(module, exports, __webpack_require__) {
  46387. "use strict";
  46388. /***/ }),
  46389. /***/ "./node_modules/webpack/buildin/module.js":
  46390. /*!***********************************!*\
  46391. !*** (webpack)/buildin/module.js ***!
  46392. \***********************************/
  46393. /*! no static exports found */
  46394. /***/ (function(module, exports, __webpack_require__) {
  46395. "use strict";
  46396. module.exports = function (module) {
  46397. if (!module.webpackPolyfill) {
  46398. module.deprecate = function () {};
  46399. module.paths = [];
  46400. // module.parent = undefined by default
  46401. if (!module.children) module.children = [];
  46402. Object.defineProperty(module, "loaded", {
  46403. enumerable: true,
  46404. get: function get() {
  46405. return module.l;
  46406. }
  46407. });
  46408. Object.defineProperty(module, "id", {
  46409. enumerable: true,
  46410. get: function get() {
  46411. return module.i;
  46412. }
  46413. });
  46414. module.webpackPolyfill = 1;
  46415. }
  46416. return module;
  46417. };
  46418. /***/ })
  46419. /******/ });
  46420. });
  46421. //# sourceMappingURL=ivprog.bundle.js.map